Works fine in studio, but fails in an actual server. No errors in output, and even debugging failed to show the problem, as "1" never prints, and it's literally the first line after the .touched function. I might be dumb, but I have absolutely no idea why this isn't working. FilteringEnabled is on if it matters, and this script is simply in a normal part inside of workspace.
local debounce = false script.Parent.Touched:connect(function(player) print("1") if debounce == false then print("2") debounce = true game.ReplicatedStorage.events.sndGiggle:FireClient(player) game.Workspace.game.assets.location1:Destroy() game.ReplicatedStorage.assets.location2:Clone().Parent = game.Workspace.game.assets game.ReplicatedStorage.assets.location2a:Clone().Parent = game.Workspace.game.assets game.Workspace.events.metaldoor1:Destroy() game.Workspace.events.lights1:Destroy() game.Workspace.events.trigger.location1:Destroy() end end)
Why, just why.
Not 100% sure, don't take my word, but you might not be able to get player from onTouch directly. Instead try this...
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local plr = workspace[hit.Parent.Name] local player = game.Players:GetPlayerFromCharacter(plr) --Stuff here end end)