Hi,
I have made this script for my seat to give a person a Screen GUI. But then I forgot that every time I go into the seat it will give me the GUI again. What do I have to put in to make it so that the next time I sit in the seat with the GUI already on my screen, it does not give me the GUI again? Please bear in mind that I want to have the GUi on my screen when I leave the seat also.
Script:
seat = script.Parent.Seat gui = script.Parent.MyGui seat.ChildAdded:connect(function(newWeld) character = newWeld.Part1.Parent player = game.Players:GetPlayerFromCharacter(character) if player.Backpack:FindFirstChild("Staff") then guiClone = gui:Clone() guiClone.Parent = player.PlayerGui end end)
Thanks Kieran
All you need to do is check if it exists already.
seat = script.Parent.Seat gui = script.Parent.MyGui seat.ChildAdded:connect(function(newWeld) lcoal character = weld.Part1.Parent local player = game.Players:playerFromCharacter(character) if player.Backpack:FindFirstChild("Staff") then if player.PlayerGui:findFirstChild(gui.Name) then return end -- This checks if there is one already. If it exists, it returns, and end the function call. If it doesn't exist, it continues. guiClone = gui:Clone() guiClone.Parent = player.PlayerGui end end)