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

How to make GUI that can be viewed between 2 players?

Asked by 4 years ago

I'm trying to script a gui card game and finished making its foundation but I don't know how to go about making the same gui visible to 2 players at the same time. I want too make something similar to the trade guis you see on games where the view is inverted for each player.

Something like this but for 2 players instead of 4: http://www.searchamateur.com/pictures/hearts-solitaire-online-1.jpg

0
Use remote event to fire changes bet royaltoe 5144 — 4y
0
To each client typo royaltoe 5144 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

1st. If you want to be visible when they join try using a script that will clone the GUI in the replicated storage to the certain player.

game.Player.PlayerAdded:Connect(function(plr)
       if plr.Name == "" then -- player name
                   game:GetService("ReplicatedStorage").GUI.GUI.Visible = false
         end
end)

Fill out GUI with the GUI name and the second GUI for the Frame or TextLabel or anything that is a GUI.

2nd. Try using a Remote Event to Fire to the server and then return it to the player using FireClient.

In Local Script

local re = Instance.new("RemoteEvent", game.ReplicatedStorage)
local plrNames = {"snowwyyyyy2", "Therealbaddude", "Someone"}
re:FireServer()
wait()
re.OnClientEvent:Connect(function(plr)
        for _, playerName in pairs(plrNames) do 
                 if plr.Name == playerName then
                       --Show gui or any other code down below
       end
end)

In Server Script


wait(5) game:GetService("ReplicatedStorage").RemoteEvent.OnServerEvent:Connect(function(plr) game:GetService("ReplicatedStorage").RemoteEvent:FireClient(plr) end)
Ad

Answer this question