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

Choosing other players not working?

Asked by 5 years ago
for i, loopPlayer in pairs(game.Players:GetPlayers()) do
local MasterControl = require(loopPlayer:WaitForChild("PlayerScripts"):WaitForChild("ControlScript"):WaitForChild("MasterControl"))
local m = game.Players.LocalPlayer:GetMouse()
local character = game.Players.LocalPlayer.Character
local active = false
local Humanoid = character:WaitForChild("Humanoid")

db = false
m.KeyDown:connect(function(k)
k = k:lower()
if k == 'x' then
    if db == false then
        game.Lighting.ColorCorrection.Enabled = true
        game.Workspace.TimeStop:Play()
        active = true
        if active == true then
            while wait(1) do 
                Humanoid.Health = Humanoid.Health - 1.5
            end
        end
        if loopPlayer ~= game.Players.LocalPlayer then
        MasterControl:Disable()
        game.Lighting.Blur.Enabled = true
        loopPlayer.PlayerGui.Time.TextLabel.Visible = true
        wait(20)
        db = true
    end
    end
    if db == true then
        game.Lighting.ColorCorrection.Enabled = false
        game.Workspace.TimeStop:Stop()
     if loopPlayer ~= game.Players.LocalPlayer then
        MasterControl:Enable() 
        game.Lighting.Blur.Enabled = false
        loopPlayer.PlayerGui.Time.TextLabel.Visible = false
        db = false
        end
    end
end
end)
end

I tried to print loopPlayer and it gives me ONLY my username and never others. I used Test Server in Studio.

1
You tested in studio?.... There's only one player in Studio and that's you.... -_- Pojoto 329 — 5y
0
LOL User#23365 30 — 5y
0
also keydown is decaperated, use inputbegan from userinputservice User#23365 30 — 5y
0
@Pojoto I used local server test.... Fixer1987 95 — 5y
1
wait() should NOT be a condition in while loops. User#19524 175 — 5y

Answer this question