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

Script works in edit mode, not in actual game?

So I made this and don't really understand why it works in studio and not on my game. I'm unsure how I would get it to work. As of now it's in a normal script and not a local, though that's probably the problem. Though when I put it in a local script it still did not work. Eh, I'm clueless anyhow.

script.Parent.Touched:connect(function(Hit)
	local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
	local humanoid = Hit.Parent:FindFirstChild("Humanoid")
	if Player then
	Player.PlayerScripts.ControlScript.Disabled = true
	humanoid:MoveTo(workspace.EndPlate.Position)
	wait(10)
	Player.PlayerScripts.ControlScript.Disabled = false
	
	end
end)

2 answers

Check if your on filtering enabled.

1 comment

0

And if it is on, what would you suggest? Turning it off?

Servers cannot access PlayerScripts, consider making this local. eg.

game.Workspace.Button.Touched:connect(function(Hit)
	if Hit.Parent.Name == game.Players.LocalPlayer.Name then
		if game.Players.LocalPlayer.Character then
			game.Players.LocalPlayer.PlayerScripts.ControlScript.Disabled = true
			game.Players.LocalPlayer.Character.Humanoid:MoveTo(workspace.EndPlate.Position)
			wait(10)
			game.Players.LocalPlayer.PlayerScripts.ControlScript.Disabled = false
		end
	end
end)

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