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

Script Help! PLEASE HELP?

This is what I have so far. It works fine but it gives you more then one GUI when you step on it. I need a add on so it checks to see if you already have a GUI and not give you one if you already do have one

function onTouch(hit)

local ptt = game.Players:playerFromCharacter(hit.Parent)
if ptt == nil then return end 
local wfp = script.Parent:findFirstChild("HandtoGui"):clone() 
if wfp == nil then return end 
wfp.Parent = ptt.PlayerGui
end

script.Parent.Touched:connect(onTouch)

1 answer

✓ Accepted answer

You could set a line that returns false if it finds that GUI in their PlayerGui. So..

function onTouch(hit)
	local ptt = game.Players:GetPlayerFromCharacter(hit.Parent)
	if ptt == nil then return end
	local wfp = script.Parent:findFirstChild('HandtoGui"):clone()
	if ptt.PlayerGui:findFirstChild("HandtoGui") then return end
	wfp.Parent = ptt.PlayerGui
end

script.Parent.Touched:connect(onTouch)

1 comment

0

Thank you Shawny

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