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

how to change the property of the player?

i want to change the property of the player when he joins the game like making his JumpPower = 65 so how do i do it?

2 answers

✓ Accepted answer
function jumpadd(player) -- function that is connected to the event, the player variable is a parameter that is passed from the event which gives you the player itself which you can access the character by using .Character which accesses that Character in Workspace (once it loads)
	player.CharacterAdded:Wait() -- CharacterAdded is an event as well so it can be connected to a function but here we use it to wait for it instead
	player.Character:WaitForChild("Humanoid") -- Waits for Humanoid to be added in Character
	player.Character.Humanoid.JumpPower = 65 -- edits/changes the property
end
game.Players.PlayerAdded:Connect(jumpadd) -- event to be connected to function

Connect the PlayerAdded event to the function, then wait for character to be added and humanoid to be added which is part of Character then the property JumpPower is part of the Humanoid so change that to 65. This is a server script so create a "Script" for this and not a "LocalScript", you should also place it in ServerScriptService (in Explorer) for it is best used to have server-sided scripts.

PlayerAdded: Fires when a player joins the game

CharacterAdded: Fires when addressed player's character loads in

:WaitForChild(): Waits until named child in paranthesis exists within the addressed object (in this case, Character)

JumpPower: The property you are looking for

game.Players.LocalPlayer.Character.Humanoid.JumpPower = 65

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