This is more simple than the other question. If you don't want the gui to disappear when they jump, just resize the part. This is VERY SIMPLE! It doesn't do anything with the player's torso position.
You can use the Touched event to see if the play touched it:
script.Parent.Touched:connect(function(part)
print("A part named "..part.Name.." has touched me!")
end)
The output would say
A part named part has touched me!
A part named part has touched me!
A part named part has touched me!
A part named part has touched me!
A part named part has touched me!
That is because there is no debounce to make it work once. This is it with a debounce:
local debounce = false
script.Parent.Touched:connect(function(part)
if not debounce then
print("A part named "..part.Name.." has touched me!")
end
end)
The output will be:
A part named part has touched me!
Did you know that Touched event has a brother? It's called TouchEnded. As you can guess TouchedEnded fires when something leaves the part.
script.Parent.TouchEnded:connect(function(part)
print(part.." has left this BasePart :C")
end)
OutPut:
Part has left this BasePart :C
Now we add all this together, but first we need to see what the family tree must be like.
Part in workspace, Script in Part, Gui in Script.
script.Parent.Touched:connect(function(char)
local player = game.Players:GetPlayerFromCharacter(char)
if player and not player.PlayerGui.StoreGui then
script.StoreGui:clone().Parent = player.PlayerGui
end
end)
script.Parent.TouchEnded:connect(function(char)
local player = game.Players:GetPlayerFromCharacter(char)
if player and player.PlayerGui.StoreGui then
player.PlayerGui.StoreGui:Destroy()
end
end)
Here is the link to Destroy and Clone.
I hope this helps.
PS: I am aware that there is another answer. I just answered anyway since you seemed confused.
3 comments
Wow, you did it. But, something I was confused about is all the Torso.Positioning. can you explain a little of that to me?
How's that?
I wouldn't rely on TouchEnded, by the way. If you walk on the part, then it will repeatedly destroy and clone the gui, and it's likely that roblox won't recognize when the touch is ended and the gui will be stuck on your screen.