So I am trying to make a command that chooses a random pickup line and I can’t get it to work. This is what I have and I don’t know why but it always comes up as an “Unexpected Identifier”
Hey $(touser), $(eval const responses = [‘Are you an angel? Cause you\’re perfect.’, ‘If you were an angel, then I’d be a devil. I just want to corrupt you’,’ If you\’re an angel imma start going to church so I can go to heaven and see you’, ‘Are you Cupid cause the moment I saw you I fell in love.’]; responses[Math.floor(Math.random() * responses.length)]; )
Use
"
and
\
if you are using
’
in a middle of array.
Hey $(touser), $(eval const responses = [“Are you an angel? Cause you are perfect.”, “If you were an angel, then I would be a devil. I just want to corrupt you”, “If you are an angel imma start going to church so I can go to heaven and see you”, “Are you Cupid cause the moment I saw you I fell in love.”]; responses[Math.floor(Math.random() * responses.length)]; )
Ok so i tried what you wrote and it still says Invalid or Unexpected token. Thank you, though.
Hey @babyv02!
By replacing your single quote marks with backticks `
it should fix it:
$(eval r=[`are you an angel? Cause you're perfect.`, `if you were an angel, then I'd be a devil. I just want to corrupt you.`, `if you're an angel imma start going to church so I can go to heaven and see you.`, `are you Cupid cause the moment I saw you I fell in love.`]; `Hey $(touser), ${r[Math.floor(Math.random()*r.length)]}`)
@Emily so i think you’re code almost works but the thing says its “Missing } in the template expression” I am very bad at this and don’t see where it would even go
That’s a weird issue, it wasn’t happening until then, so I’m not sure why it wasn’t working, but anyway, I fixed it and updated my previous reply.
Now this will work 100% self tested
Hey $(touser), $(eval const r = [`Are you an angel? Cause you are perfect.`, `If you were an angel, then I would be a devil. I just want to corrupt you`, `If you are an angel imma start going to church so I can go to heaven and see you`, `Are you Cupid cause the moment I saw you I fell in love.`]; r[Math.floor(Math.random() * r.length)]; )
i literally copy and pasted what you wrote but for some reason i am getting the saem outcome as before
Have you copied the updated version of my first reply? Because I can assure you it works.
$(eval r=[`are you an angel? Cause you're perfect.`, `if you were an angel, then I'd be a devil. I just want to corrupt you.`, `if you're an angel imma start going to church so I can go to heaven and see you.`, `are you Cupid cause the moment I saw you I fell in love.`]; `Hey $(touser), ${r[Math.floor(Math.random()*r.length)]}`)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.