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

Why is this script not working?

Asked by
duckyo01 120
8 years ago

I bet it's a really simple problem but I can't find it. I want it so if you touch the Door a gui appears.

script.Parent.Touched:connect(function(hit)
    local Guy = game.Players:GetPlayerFromCharacter(script.Parent)
    if Guy then

    if Guy.PlayerGui.Riddles:FindFirstChild("Riddle") then
        Guy.PlayerGui.Riddles:FindFirstChild("Riddle"):Destroy()
    local Riddle = script.Parent.Riddle:clone()
                Riddle.Parent = Guy.PlayerGui.Riddles

        end
    end
end)

1 answer

Log in to vote
1
Answered by 8 years ago
script.Parent.Touched:connect(function(hit)
    if game.Players:FindFirstChild(hit.Parent.Name)  ~= nil then
local guy = game.Players:FindFirstChild(hit.Parent.Name)
    if Guy.PlayerGui.Riddles:FindFirstChild("Riddle") then
        Guy.PlayerGui.Riddles:FindFirstChild("Riddle"):Destroy()
    local Riddle = script.Parent.Riddle:clone()
                Riddle.Parent = Guy.PlayerGui.Riddles
        end
    end
end)

0
What do you mean by anem duckyo01 120 — 8y
0
?????? User#5978 25 — 8y
0
Name sorry duckyo01 120 — 8y
Ad

Answer this question