Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why does my code show up as a error? i am confuse please help i am new to lua.

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"

3 comments

0

use lua text box

0

how do i use a lua text box

0

god the indentation

1 answer

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

2 comments

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!

0

I just had the end) so it was confused what detector was

This discussion is preserved as it was. New answers, comments, and votes are closed.