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

Why does my kill all script when ''F'' is pressed work in roblox studio but not in online?

Asked by
ali7682 17
6 years ago

Hi, i made a script that can kill every player in the server if you press ''F''' on your keyboard and it works fine, however, it doesn't when i test this in online roblox server but it does work in roblox studio. I think it's because the script i made is located inside workspace or because it's just a normal script? I'm not sure. Can anyone help me? Oh btw, how do i make this script that only the owner or my username ''ali7682'' can kill everyone by just pressing ''F''? Thanks! (Here is the script if needed).

local uis = game:GetService("UserInputService")
uis.InputBegan:connect(function(inst)
    if inst.KeyCode == Enum.KeyCode.F then
        for i, player in ipairs(game.Players:GetPlayers()) do
            if player.Character then
                local hum = player.Character:FindFirstChild('Humanoid')
                if hum then
                    hum.Health = 0
                end
            end
        end
    end
end)
0
Not localscript blowup999 659 — 6y
0
And if it's a localscript run it in ReplicatedFirst, because it won't run in workspace or some other places blowup999 659 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Make it a localscript and put it in starterplayerscripts.

0
How do i make it that only me (the owner) can use that? ali7682 17 — 6y
Ad

Answer this question