A random power to all players at a random time

I want to give a random power to all players at a random time (example: speed, jump, char) but how can I do this from the server

I tried a little but failed

game.Players.PlayerAdded:Connect(function(player)
	local character = player:WaitForChild("Character")
	local humanoid = character:WaitForChild("Humanoid")
	local JumpPower = humanoid.JumpPower
	
	--
	local Skills = {
	function()
			humanoid.WalkSpeed += 2
		return "More WalkSpeed"
	end,
	function()
		JumpPower += 10
		return 	"More Jump"
	end,
}
	local RandomSkill = Skills[math.random(1,#Skills)]
	
	--
	
	while wait(180) do
		RandomSkill()
		wait(60)
		resetUser()
	end
end)

First error I see, you’re trying to update JumpPower through a variable. That variable stores the humanoid’s JumpPower at the time of creating the variable. You’d have to do the same thing you did with WalkSpeed, so Humanoid.JumpPower += 10.
As for the random skill generator, you need to update RandomSkill every time otherwise it will always be the same function.

while wait(180) do
    RandomSkill = Skills[math.random(1,#Skills)]
	RandomSkill()
	wait(60)
	resetUser()
end

Or if you don’t need it you can get rid of the variable entirely.

while wait(180) do
    Skills[math.random(1,#Skills)]()
	wait(60)
	resetUser()
end
1 Like

gives an error
image

You forgot to add end) for the PlayerAdded event.

1 Like