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)

2 comments
Not localscript
And if it's a localscript run it in ReplicatedFirst, because it won't run in workspace or some other places