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 4 years ago
Edited 4 years ago

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"

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

1 answer

Log in to vote
0
Answered by
karlo_tr10 1233 Moderation Voter
4 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 — 4y
0
I just had the end) so it was confused what detector was vortex767 20 — 4y
Ad

Answer this question