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

How to make a GUI disappear when stop touching a part?

I had never used a TouchEnded before,so I need a script,not a hint.My problem is idk how to make a gui appear when touch a part.I have scripts when touch a part the gui will appear:

in the replicatedStorage ther is a remote event

a script in SeverScriptService:

 game.Workspace.Shop.Touched:Connect(function(hit)
     if game.Players:GetPlayerFromCharacter(hit.Parent)then
	     game.ReplicatedStorage.RemoteEvent:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
     end
 end)

and a script in the gui:

 game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
     script.Parent.Main.Visible = not script.Parent.Main.Visible
     end)

1 comment

0

you could copy and paste the script and instead of Shop.Touched you could use Shop.TouchEnded

1 answer

This might work:

game.Workspace.Shop.Touched:Connect(function(hit)
    if game.Players:GetPlayerFromCharacter(hit.Parent)then
        game.Workspace.Shop.Touched:Wait()
        game.ReplicatedStorage.RemoteEvent:FireClient(game.Players:GetPlayerFromCharacter(hit.Parent))
    end
end)

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