local Ready = true
script.Parent.LeverHandle.ClickDetector.MouseClick:Connect(function()
script.Parent.LeverHandle:Destroy() script.Parent.LeverEnd:Destroy() local Detecto = Instance.new("Part") Detecto.Parent = game.Workspace Detecto.Anchored = true Detecto.CanCollide = false Detecto.Size = Vector3.new(13.52, 8.4, 8.8) Detecto.Position = Vector3.new(-4.63, 5.199, 87.737) Detecto.Transparency = 1 Detecto.Name = "Detector"
end)
script.Parent.Parent.Detector.Touched:Connect(function(hit)
local H = hit.Parent:FindFirstChild("Humanoid") if H ~= nil and Ready == true then Ready = false local plyr = game.Players:FindFirstChild(H.Parent.Name) plyr.PlayerGui.Dialog.Backround.TextBox2.Text = "Run!" wait(1.5) plyr.PlayerGui.Dialog.Backround.TextBox2.Text = "" end
end)
and the error show up like this "Detector is not a valid member of Workspace"
Maybe you got 1 spare Parent
cause you are referring to workspace not click detector.