How to change player JumpPower if a player is in a group?

Title says it all. __________________________________________________________

You can check whether player is a member of certain group or not using :GetRankInGroup(), which returns 0 in case player is not a member, if I recall correctly.

local GROUP_ID = 0 -- group ID
local JUMP_POWER = 0 -- jump power

game:GetService("Players").PlayerAdded:Connect(function(player)
	if player:IsInGroup(0) then
		player.CharacterAdded:Connect(function(character)
			local humanoid = character.Humanoid
			humanoid.JumpPower = JUMP_POWER
		end)
	end
end)

EDIT @GEILER123456 thanks for that suggestion, I changed this version too in case anyone used it in the future. :slight_smile:

3 Likes

Adding on to that, you can use an if-statement right after the player joins and only if he is in the group, connect the event. That would be a bit better for performance, as it only has to check once.

local GROUP_ID = 0 -- group ID
local JUMP_POWER = 0 -- jump power

game:GetService("Players").PlayerAdded:Connect(function(player)
	if player:IsInGroup(0) then
		player.CharacterAdded:Connect(function(character)
			local humanoid = character.Humanoid
			humanoid.JumpPower = JUMP_POWER
		end)
	end
end)
1 Like