If you want a TweenPosition, then I got one for you.
First insert a normal Script inside of the part you want to touch.
Then put the ScreenGUI inside of the script and name it for example "Shop" in your script. (If you want to change the name of your ScreenGUI, then also change it in the script that ahs the name Shop)
And then once you put it all in it should look like this: Part > Script > Shop
Here's the script:
local Delay = 1
function onTouch(hit)
if game.Players:FindFirstChild(hit.Parent.Name) then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if not player.PlayerGui:FindFirstChild("Shop") then
local gui = script.Shop:Clone()
gui.Parent = player.PlayerGui
gui.Frame:TweenPosition(UDim2.new(.5,0,.5,0),"Out","Quad",Delay,true)
repeat wait() until (player.Character.HumanoidRootPart.Position - script.Parent.Position).magnitude > 5
gui.Frame:TweenPosition(UDim2.new(.5,0,-.5,0),"Out","Quad",Delay,true)
wait(Delay)
gui:Remove()
end
end
end
script.Parent.Touched:Connect(onTouch)
4 comments
If you don't have experience with Lua then there's no point in helping you giving you free code. Learn by starting at developer.roblox.com
lol
Use Touched and TouchEnded events
GUI wont really work with touching a brick that easily.. you need to use Remote Events.