local player = game:GetService("Players").PlayerAdded:Wait()
local JumpPowerData = player:WaitForChild("Data").JumpPower
JumpPowerData.Changed:Connect(function()
if (player.Character) then
local humanoid = game:GetService("Workspace"):FindFirstChild(player.Name):WaitForChild("Humanoid")
humanoid.JumpHeight = JumpPowerData.Value
end
end)
This is the script and when 2 players join 1 cant jump high
local Players = game:GetService("Players")
local Everyone = Players:GetPlayers()
JumpPowerData.Changed:Connect(function()
for i, Player in pairs(Everyone) do
local humanoid = Player.Character.Humanoid
humanoid.JumpHeigh = JumpPowerData.Value
end
end)
Script is made using openai chatgpt try to use this
local playerJumpPowers = {}
local function onPlayerAdded(player)
local JumpPowerData = player:WaitForChild("Data").JumpPower
playerJumpPowers[player.Name] = JumpPowerData
JumpPowerData.Changed:Connect(function()
if (player.Character) then
local humanoid = game:GetService("Workspace"):FindFirstChild(player.Name):WaitForChild("Humanoid")
humanoid.JumpHeight = JumpPowerData.Value
end
end)
end
game:GetService("Players").PlayerAdded:Connect(onPlayerAdded)
-- Connect any existing players
for _, player in pairs(game:GetService("Players"):GetPlayers()) do
onPlayerAdded(player)
end
This version of the script defines a table called playerJumpPowers that will be used to store the JumpPower values for each player. It then defines a function called onPlayerAdded that is called whenever a new player joins the game. This function stores the player’s JumpPower value in the playerJumpPowers table and sets up a connection to the Changed event of the JumpPower value. When the Changed event fires, the script checks if the player has a character and, if they do, sets the JumpHeight of their humanoid to the current value of their JumpPower value.
Finally, the script connects the PlayerAdded event of the Players service to the onPlayerAdded function, and also calls the onPlayerAdded function for any players that are already present in the game. This ensures that the JumpPower values for all players are stored correctly and that the Changed event is properly set up for all players.
I just put the changed loop in a player added function so i get each player that joins and then checks after that player and not the first person that joins