Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My random position script wont work! Can anyone help?Do i need remotes?!?

Asked by 5 years ago
while true do
    wait(0.25)
        local pos1 = math.random(-163.245,163.245)
        local pos2 = math.random(-163.245,163.245)

       local coin = game.ServerStorage.Coin:Clone(game, workspace)

        coin.Position = Vector3.new(pos1, 21, pos2)

end? 

I've been trying to spawn in coins at random position why wont this work?

here is the error in output "ServerScriptService.Script:10: unexpected symbol near '?"

0
You have a random question mark next to your end User#24403 69 — 5y
0
You have a syntax error. Syntax errors are what prevent your code from compiling in the first place User#24403 69 — 5y
0
how do i fix this syntax error? mdbaten2 24 — 5y
0
u delete the question mark Be_Happy1373 32 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

Try this:

while true do
    wait(0.25)
        local pos1 = math.random(-163.245,163.245)
        local pos2 = math.random(-163.245,163.245)

       local coin = game.ServerStorage.Coin:Clone()
       coin.Parent = game.Workspace

        coin.Position = Vector3.new(pos1, 21, pos2)

end

you put "Coin:Clone(game,workspace)" (you put a ',' instead of a '.') and since I am unsure of the arguements for that function , I just set the parent with coin.Parent. Edit: Sorry I didn't see that someone else already answered it :/

Ad
Log in to vote
0
Answered by
Kikitob 105
5 years ago

You added a ? at the end on line 10 remove it and Clone doens't have variables you have to manualy parent it.

0
still does not work! I changed it? mdbaten2 24 — 5y
0
Whats the error then? Kikitob 105 — 5y
0
The error in output is ServerScriptService.Script:9: unexpected symbol near '?' i changed everything you told me to but it still wont work mdbaten2 24 — 5y
0
i told you to remove the ? Kikitob 105 — 5y
View all comments (6 more)
0
i did mdbaten2 24 — 5y
0
then why does the error still says that there is a ? Kikitob 105 — 5y
0
some other guy said its some syntax error im not sure mdbaten2 24 — 5y
0
it is the ? is causing it Kikitob 105 — 5y
0
But i removed it... mdbaten2 24 — 5y
0
Ok edit your question with the script you changed it too Kikitob 105 — 5y

Answer this question