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

Problem with a forcefield appearing upon GUI Click? [SOLVED]

Asked by
Agios 10
9 years ago

The script is supposed to teleport players to a brick on click, then make the gui non visible, then give them FF. The only thing not working is the FF.

lol silly me I forgot it's game.LocalPlayers.Player.Character, not game.LocalPlayers.Player

EDIT I pasted in the wrong code, sorry I still solved the problem tho

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Please put your code in lua block from this point on

I didn't even see anything in your code about a ForceField. Also, don't restate events.. just put all actions in one. And you had two of the same things..

wait() math.randomseed(tick()) 

local player = game.Players.LocalPlayer 

script.Parent.MouseButton1Click:connect(function() 
    player.Character:MoveTo(workspace['spawn'..math.random(5)].Position)
    script.Parent.Visible = false
    local f = Instance.new('ForceField',player.Character)
    coroutine.wrap(function() wait(7) f:Destroy() end)()
end)
Ad

Answer this question