For some reason, whenever I clone a model into the Workspace (from ReplicatedStorage), the player detection script works in Studio, but not in-game. I've tried inputting the code into a local script, but it stops working entirely.
Here's the code:
local floor = script.Parent
local light = script.Parent.Parent.MainLight.SurfaceLight
player = game.Players.LocalPlayer
ambience = game.Lighting.Ambient
local debounce = false
s1=game.Workspace.Scream1
s2=game.Workspace.Scream2
s3=game.Workspace.Scream3
function Caught(part)
local h = part.Parent:findFirstChild("Humanoid")
if h ~= nil then
h.WalkSpeed= 0
if (h ~= nil) then
h.WalkSpeed = 0
game.Workspace["In-Game Music"]:Stop()
wait(2.5)
game.Workspace.Alarm:Play()
ambience = Color3.new(255/255,255/255,255/255)
script.Parent.Parent.MainLight.Material = "Neon"
light.Enabled = true
wait(1.5)
s1:Play()
s2:Play()
wait(5)
player.PlayerGui.GameRecap.Enabled = true
player.PlayerGui.GameRecap.EP.LVL.L1.LoseLvl.Visible = true
wait(4)
game.Workspace.Alarm:Stop()
ambience = Color3.new(30/255,30/255,30/255)
game.Workspace["In-Game Music"]:Play()
wait(1)
debounce = false
end
end
end
script.Parent.Touched:connect(Caught)
