Basically, when someone touches the part it should TP them away and make a GUI appear on their screen. When I go up to it, it clones the GUI numerous times instead of once.
How do I fix this?
script.Parent.Touched:Connect(function(hit)
if hit.Parent.ClassName == "Model" and hit.Parent.Humanoid ~= nil then
local character = hit.Parent
character.HumanoidRootPart.CFrame = CFrame.new(workspace["SecurityTP:A"].Position)
local player = game.Players:GetPlayerFromCharacter(character)
local clone = script.ScreenGui:Clone()
clone.Parent = player.PlayerGui
clone.Frame.Visible = true
clone.Frame:TweenSizeAndPosition(UDim2.new(0.466, 0,0.185, 0), UDim2.new(0.266, 0,0.408, 0))
wait(3)
clone.Frame:TweenSizeAndPosition(UDim2.new(0,0,0,0), UDim2.new(0.5,0,0.408,0))
wait(1)
clone:Destroy()
end
end)

3 comments
I'd say just check the players gui if they have the one and if they dont then add it if they do dont do anything you can alos add in something called a debounce which may help.
add a debounce ez pz if debounce = true then ___ end
i forgot how to debounce, haven't uses it in a while