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

Script works in edit mode, not in actual game?

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago

Check if your on filtering enabled.

0
And if it is on, what would you suggest? Turning it off? User#11440 120 — 7y
Ad
Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

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)

Answer this question