position = {Vector3.new(5,5,5),Vector3.new(34,45,0)
script.Parent.MouseButton1Click:connect(function()
game.Players.LocalPlayer.Character.Torso.CFrame = CFrame.new(position[math.random(#position)])
end)
This code will not work because you shouldn't have a end) statement when you don't even have a starter statement, here's an example on what i think you were trying to do.
function onClick(mouse)
position = Vector3.new(5,5,5),Vector3.new(34,45,0)
game.Players.LocalPlayer.Character.Torso.CFrame =CFrame.new(position[math.random(#position)])
end
script.Parent.MouseButton1Click:connect(OnClick)
10 comments
That us the full code
is*
Ok, thanks man!
Wait it says MouseButton1Click is not a valid member of the screengui
Is this script a parent of the button and the button only?
it just on the screen gui
Parent it to the button you want clicked.
So i placed the button in the localscript?
No, place the script as the parent of the button
Im so confused Ok I have a gui and I placed the button into the localscript. Is that how?