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

Why is this script not working?

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

✓ Accepted answer
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)

3 comments

0

What do you mean by anem

0

??????

0

Name sorry

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