Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
lamgogo 56
3 years ago
Edited 3 years ago

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)
0
you could copy and paste the script and instead of Shop.Touched you could use Shop.TouchEnded jedistuff2 89 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

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)
Ad

Answer this question