Answered by
4 years ago Edited 4 years ago
First, in your Server Script, instead of Firing Clients separately, you can Fire all clients at once:
1 | game.ReplicatedStorage.RemoteEvents.ShareEvid:FireAllClients() |
And the line above it, where server is receiving, you can do:
1 | game.ReplicatedStorage.RemoteEvents.ShareEvid.OnServerEvent:Connect( function (plr) |
And on line 67, I assume you are using:
1 | game.ReplicatedStorage.RemoteEvents.ShareEvid.OnClientEvent:Connect( function (player) |
Instead, you can simply do:
1 | game.ReplicatedStorage.RemoteEvents.ShareEvid.OnClientEvent:Connect( function () |
Then, you can make the Local Player the parent of the Gui:
1 | Gui.Parent = plr:WaitForChild( "PlayerGui" ) |
I assume the Gui is already present in Starter Gui.
This is how your end part of Local script moght look:
1 | game.ReplicatedStorage.RemoteEvents.ShareEvid.OnClientEvent:Connect( function () |
2 | local Gui = plr:WaitForChild( "PlayerGui" ).Evidence.Draw:Clone() |
3 | Gui.Parent = plr:WaitForChild( "PlayerGui" ) |
4 | Gui.Top.Text = plr.Name.. "'s Evidence" |
If it doesn't work, lemme know the errors.
Please Upvote and lemme know if it helped!
Edit: You told me that a player draws something on Canvas, so it shows on every player's Gui.
It's just an eg, which does not represent your script in any way.
Take the idea from here, and implement it in your game.
for that, u can do:
04 | local player = game.Players.LocalPlayer |
05 | local canvas = player:WaitForChild( "PlayerGui" ).CanvasGui:GetChildren() |
06 | local canvasG = player:WaitForChild( "PlayerGui" ).CanvasGui |
08 | script.Parent.MouseButton 1 Click:Connect( function () |
09 | if game.ReplicatedStorage.CanvasBool.Value = = true then |
10 | game.ReplicatedStorage.CanvasR:FireServer(canvas) |
14 | game.ReplicatedStorage.CanvasR.OnClientEvent:Connect( function (canvasC) |
15 | for i, v in pairs (canvasC) do |
16 | local clone = v:Clone() |
17 | clone.Parent = canvasG |
22 | game.ReplicatedStorage.CanvasR:OnServerEvent:Connect( function (plr, canvas) |
23 | game.ReplicatedStorage.CanvasBool.Value = true |
24 | if game.ReplicaredStorage.CanvasBool.Value = = true then |
25 | for i, v in pairs (canvas) do |
26 | local clone = v:Clone() |
27 | clone.Parent = game.ReplicatedStorage.Canvas |
30 | local canvasContents = game.ReplicatedStorage.CanvasR:GetChildren() |
32 | game.ReplicatedStorage.CanvasR:FireAllClients(canvasContents) |
33 | game.ReplicatedStorage.CanvasBool.Value = false |
39 | Hope it helps! Lemme know. |