Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

0

Not localscript

0

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

1 answer

✓ Accepted answer

Make it a localscript and put it in starterplayerscripts.

1 comment

0

How do i make it that only me (the owner) can use that?

This discussion is preserved as it was. New answers, comments, and votes are closed.