scriptRunning = false
script.Parent.Touched:connect(function()
if scriptRunning then
print 'Running'
end
if not scriptRunning then
scriptRunning = true
wait(0.1)
game.Workspace.Tube.Transparency = 0.9
game.Workspace.Tube.Transparency = 0.8
wait(2)
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 0
game.Players.LocalPlayer.Character.Torso.CFrame = game.Workspace.Center.CFrame
wait(1)
game.Lighting.ParticleEmitter:Clone().Parent = game.Players.LocalPlayer.Character.Torso
game.Lighting.ParticleEmitter:Clone().Parent = game.Players.LocalPlayer.Character["Right Arm"]
game.Lighting.ParticleEmitter:Clone().Parent = game.Players.LocalPlayer.Character["Left Arm"]
wait(4)
game.Players.LocalPlayer.Character["Right Leg"].Transparency = 0.2
game.Players.LocalPlayer.Character["Left Leg"].Transparency = 0.2
wait(0.1)
game.Players.LocalPlayer.Character["Right Leg"].Transparency = 0.4
game.Players.LocalPlayer.Character["Left Leg"].Transparency = 0.4
wait(0.1)
game.Players.LocalPlayer.Character["Right Leg"].Transparency = 0.6
game.Players.LocalPlayer.Character["Left Leg"].Transparency = 0.6
wait(0.1)
game.Players.LocalPlayer.Character["Right Leg"].Transparency = 0.8
game.Players.LocalPlayer.Character["Left Leg"].Transparency = 0.8
wait(0.1)
game.Players.LocalPlayer.Character["Right Leg"].Transparency = 1
game.Players.LocalPlayer.Character["Left Leg"].Transparency = 1
wait(0.1)
game.Players.LocalPlayer.Character["Right Arm"].Transparency = 0.2
game.Players.LocalPlayer.Character["Left Arm"].Transparency = 0.2
game.Players.LocalPlayer.Character["Torso"].Transparency = 0.2
wait(0.1)
game.Players.LocalPlayer.Character["Right Arm"].Transparency = 0.4
game.Players.LocalPlayer.Character["Left Arm"].Transparency = 0.4
game.Players.LocalPlayer.Character["Torso"].Transparency = 0.4
wait(0.1)
game.Players.LocalPlayer.Character["Right Arm"].Transparency = 0.6
game.Players.LocalPlayer.Character["Left Arm"].Transparency = 0.6
game.Players.LocalPlayer.Character["Torso"].Transparency = 0.6
wait(0.1)
game.Players.LocalPlayer.Character["Right Arm"].Transparency = 0.8
game.Players.LocalPlayer.Character["Left Arm"].Transparency = 0.8
game.Players.LocalPlayer.Character["Torso"].Transparency = 0.8
wait(0.1)
game.Players.LocalPlayer.Character["Torso"].ParticleEmitter.Enabled = false
game.Players.LocalPlayer.Character["Right Arm"].ParticleEmitter.Enabled = false
game.Players.LocalPlayer.Character["Left Arm"].ParticleEmitter.Enabled = false
game.Players.LocalPlayer.Character["Right Arm"].Transparency = 1
game.Players.LocalPlayer.Character["Left Arm"].Transparency = 1
game.Players.LocalPlayer.Character["Torso"].Transparency = 1
wait(0.1)
game.Players.LocalPlayer.Character["Head"].Transparency = 0.2
game.Players.LocalPlayer.Character.Head["face"].Transparency = 0.2
game.Players.LocalPlayer.Character.Head["face"].Transparency = 0.2
wait(0.1)
game.Players.LocalPlayer.Character["Head"].Transparency = 0.4
game.Players.LocalPlayer.Character.Head["face"].Transparency = 0.4
wait(0.1)
game.Players.LocalPlayer.Character["Head"].Transparency = 0.6
game.Players.LocalPlayer.Character.Head["face"].Transparency = 0.6
wait(0.1)
game.Players.LocalPlayer.Character["Head"].Transparency = 0.8
game.Players.LocalPlayer.Character.Head["face"].Transparency = 0.8
wait(0.1)
game.Players.LocalPlayer.Character["Head"].Transparency = 1
game.Players.LocalPlayer.Character.Head["face"].Transparency = 1
wait(0.1)
local d = game.Players.LocalPlayer.Character:GetChildren()
for i=1, #d do
if (d[i].className == "Hat") then
d[i].Handle.Transparency = 1
end
end
wait(7)
game.Workspace.Tube.Transparency = 0.9
game.Workspace.Tube.Transparency = 1
end
end)
✓ ANSWER ACCEPTED
Why is this script only working in studio mode?
1 answer
✓ Accepted answer
LocalScripts have to go in the Player; they won't run inside of Workspace unless you're in Studio.
Scripts can't use Players.LocalPlayer
In your case, you need to look at using the part from Touched.
thing.Touched:connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent);
if player then
-- player is now the Player that touched it
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
It's not a local script, and I want it so when somebody touched it that stuff happens to them.
Scripts can't use
Players.LocalPlayer, see if you can get the Player some other wayHow else could I find the player?
Touched gives the Part.
Refer to my edit.