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

Why does this script only work for the person that clicked the text button?

Asked by 6 years ago
script.Parent.MouseButton1Down:Connect(function()
    for i, v in pairs(game.Players:GetPlayers()) do
        local playergui = v:FindFirstChild("PlayerGui")
        if playergui then
            local gui = v:WaitForChild("PlayerGui")
            if gui then
                local Hoh = gui:WaitForChild("#HOH")
                if Hoh then
                    Hoh.LocalScript.Disabled = false
                end
            end
        end
    end
end)

I looped through all the players once I click a text button. The local script is suppose to make a gui tween across the screen for everyone. I tried it and it only tweens across the screen for the person that clicked the text button. Its like it completely ignored the loop that makes it tween across the screen to everyone. Anyone got any answers? I am really really confused.

0
PlayerGui can only be accessed by the LocalPlayer. I would suggest making the LocalScript fire a RemoteEvent with :FireAllClients and then listening for that on every client, connected to an event that tweens the gui. CodyDev 70 — 6y

1 answer

Log in to vote
0
Answered by
herrtt 387 Moderation Voter
6 years ago

You should probarly use a remote that fires all clients, a serverscript cant access the playergui

0
how do i do that? andrewplayer 0 — 6y
Ad

Answer this question