Why does my code show up as a error? i am confuse please help i am new to lua.
Asked by
5 years ago Edited 5 years ago
local Ready = true
script.Parent.LeverHandle.ClickDetector.MouseClick:Connect(function()
01 | script.Parent.LeverHandle:Destroy() |
03 | script.Parent.LeverEnd:Destroy() |
05 | local Detecto = Instance.new( "Part" ) |
07 | Detecto.Parent = game.Workspace |
09 | Detecto.Anchored = true |
11 | Detecto.CanCollide = false |
13 | Detecto.Size = Vector 3. new( 13.52 , 8.4 , 8.8 ) |
15 | Detecto.Position = Vector 3. new(- 4.63 , 5.199 , 87.737 ) |
17 | Detecto.Transparency = 1 |
19 | Detecto.Name = "Detector" |
end)
script.Parent.Parent.Detector.Touched:Connect(function(hit)
01 | local H = hit.Parent:FindFirstChild( "Humanoid" ) |
03 | if H ~ = nil and Ready = = true then |
07 | local plyr = game.Players:FindFirstChild(H.Parent.Name) |
09 | plyr.PlayerGui.Dialog.Backround.TextBox 2. Text = "Run!" |
13 | plyr.PlayerGui.Dialog.Backround.TextBox 2. Text = "" |
end)
and the error show up like this "Detector is not a valid member of Workspace"