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

Why is this not updating for all players?

Asked by
Vxpper 101
4 years ago
Edited 4 years ago

Hello, I'm currently working on a script for people to request others to dual in-game, I'm working on just when a player joins, it is updated for the whole server and right now it's only showing the local players name. Why is this?

(my code is provided below, any questions just comment and I will get back to you)

EDIT: this is a RemoteEvent if that is any help, if you are able to help, please explain what you are doing so I can learn

Script in ServerScriptService

local remote = game.ReplicatedStorage.Events.Game.DualUpdater

game.Players.PlayerAdded:Connect(function(player)

    remote:FireAllClients(player, "createPlayer")

    print("remote function fired to all clients")

end)

Localscript in the gui

local remote = game.ReplicatedStorage.Events.Game.DualUpdater

remote.OnClientEvent:Connect(function(player, result)
    if result == "createValue" then
        local gui = player:WaitForChild("PlayerGui")
        local contents = gui.Dual.Handler.Multiplayer.Contents

        local tab = contents.Sample:Clone()
        print("tab cloned")

        tab.Parent = contents.Players
        print("tab.Parent = Players")

        tab.Name = player.Name
        tab.Player.Text = "".. player.Name
        tab.Visible = true
        tab.Character.Text = "".. player.Equipped.Character.Value
        print("player file successfully set up!")

        tab.Player.MouseButton1Click:connect(function(sender)
            sendremote:FireServer(player, sender)
        end)            
    end
end)

Answer this question