Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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()

01script.Parent.LeverHandle:Destroy()
02 
03script.Parent.LeverEnd:Destroy()
04 
05local Detecto = Instance.new("Part")
06 
07Detecto.Parent = game.Workspace
08 
09Detecto.Anchored = true
10 
11Detecto.CanCollide = false
12 
13Detecto.Size = Vector3.new(13.52, 8.4, 8.8)
14 
15Detecto.Position = Vector3.new(-4.63, 5.199, 87.737)
16 
17Detecto.Transparency = 1
18 
19Detecto.Name = "Detector"

end)

script.Parent.Parent.Detector.Touched:Connect(function(hit)

01local H = hit.Parent:FindFirstChild("Humanoid")
02 
03if H ~= nil and Ready == true then
04 
05Ready = false
06 
07local plyr = game.Players:FindFirstChild(H.Parent.Name)
08 
09plyr.PlayerGui.Dialog.Backround.TextBox2.Text = "Run!"
10 
11wait(1.5)
12 
13plyr.PlayerGui.Dialog.Backround.TextBox2.Text = ""
14 
15end

end)

and the error show up like this "Detector is not a valid member of Workspace"

0
use lua text box karlo_tr10 1233 — 5y
0
how do i use a lua text box vortex767 20 — 5y
0
god the indentation LoganboyInCO 150 — 5y

1 answer

Log in to vote
0
Answered by
karlo_tr10 1233 Moderation Voter
5 years ago

Maybe you got 1 spare Parent cause you are referring to workspace not click detector.

0
sorry didnt work i am try to make a lever get destroy then make a gui i put in the starter gui area to say run! vortex767 20 — 5y
0
I just had the end) so it was confused what detector was vortex767 20 — 5y
Ad

Answer this question