Guys I need help with this error that has been messing me up since I got it for the first time. Basicly the script works in studio perfectly. But, in game when I click the "Part" it says that "LocalPlayer" is a nil value..
Here's the script:
script.Parent.ClickDetector.MouseClick:connect(function()
script.Disabled = true
local backup= game.Players.LocalPlayer.PlayerGui.CatchStuffMinigame:Clone()
game.Players.LocalPlayer.PlayerGui.CatchStuffMinigame.Background:TweenPosition(UDim2.new(0,600,0,100),"In","Linear",2)
wait(10)
game.Players.LocalPlayer.PlayerGui.CatchStuffMinigame.Background:TweenPosition(UDim2.new(0,-400,0,100),"Out","Linear",2)
wait(2)
game.Players.LocalPlayer.PlayerGui.CatchStuffMinigame:Remove()
backup.Parent = game.Players.LocalPlayer.PlayerGui
wait(20)
script.Disabled = false
end)
If anyone could help me it would be GREAT!

2 comments
Youre gonna need to use a remote function or remote event. There complex but they help a lot.
https://forum.scriptinghelpers.org/topic/192/how-to-use-localplayer