Right now I’m facing an issue with my game, and i can’t find a solution to it since it doesn’t really make sense to me.
local Player = game.Players.LocalPlayer
script.Parent.Touched:Connect(function(hit)
hit.Parent.HumanoidRootPart.Position = game.Workspace.Restarter1.Position
hit.Parent.Humanoid.WalkSpeed = 0
Player.PlayerGui.WrongGui.WRONGScript.Disabled = false -- Error here
wait(1)
hit.Parent.Humanoid.WalkSpeed = 20
end)
Apparently, if you take a look at the script, you’ll notice that I’ve referenced the “LocalPlayer” in the first line of the code, and used that to get to the player’s Gui and Enable a script.
But for some reason, it stops at the 6th line and give’s me an error message in the output, as shown in the image:
I’ve tried writing down the code in different ways and even changed the script type and the parent, nothing seems to work.
I would appreciate some help if you can.
Thank You.
Local scripts do not work in workspace. use it in PlayerGui, StarterPlayerScripts, or ReplicatedFirst (or you can change it to a server script and do what iMonody_X did).
I’ve tried your script and @iMonody_X script, both of them works, however, the line where it say’s “Player.PlayerGui.WrongGui.WRONGScript.Disabled = false” activate ONLY the first time. but then stop working.
That’s not what I meant, I wanna put the script inside the part that is supposed to be touched and trigger the event, regardless of the type of the script