✓ Accepted answer
I'm gonna give you an explanation on how to appear, Gui, when the player does something on the server.
Since it's a server to client situation you need a Server Script, Remote Event, Local Script.
In this example, we have a part in the game ... When the player touches the part a GUI will appear for a couple of seconds and will disappear.
So first, create a remote event located in replicated storage.
In the local script
local rs = game:GetService("ReplicatedStorage")
local remote = rs.GuiOnChat
remote.OnClientEvent:Connect(function()
print("Frame Visible")
script.Parent.Frame.Visible = true
wait(5)
script.Parent.Frame.Visible = false
end)
what is happening here is that the local script is waiting for the event to be fired so it makes the GUI appear on the client of the player that touched the part.
Now in the server script located in the part to be touched:
local rs = game:GetService("ReplicatedStorage")
local remote = rs.AppearGui
local debounce = true
script.Parent.Touched:Connect(function(otherPart)
local char = otherPart.Parent
local player = game.Players:GetPlayerFromCharacter(char)
if player and debounce then
debounce = false
remote:FireClient(player)
wait(2)
debounce = true
end
end)
so when the part is touched, check if its a player, if its a player then fire the event which makes the GUI appear.
3 comments
Tysm!
can you replace the part with vehicle seat?
yes, vehicle seat has the .Touched event so you can replace the part with the seat