Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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 '?"

4 comments

0

You have a random question mark next to your end

0

You have a syntax error. Syntax errors are what prevent your code from compiling in the first place

0

how do i fix this syntax error?

0

u delete the question mark

2 answers

✓ Accepted answer

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 :/

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

10 comments

0

still does not work! I changed it?

0

Whats the error then?

0

The error in output is ServerScriptService.Script:9: unexpected symbol near '?' i changed everything you told me to but it still wont work

0

i told you to remove the ?

0

i did

0

then why does the error still says that there is a ?

0

some other guy said its some syntax error im not sure

0

it is the ? is causing it

0

But i removed it...

0

Ok edit your question with the script you changed it too

This discussion is preserved as it was. New answers, comments, and votes are closed.