My Character doesnt move

local function characterAdded(character : Model)
local primaryPart : BasePart = character:WaitForChild(“HumanoidRootPart”)

local newHitbox = hitbox:Clone()

local weldConstraint : WeldConstraint = Instance.new("WeldConstraint")
weldConstraint.Part0 = newHitbox
weldConstraint.Part1 = primaryPart
weldConstraint.Parent = newHitbox

newHitbox.Position = primaryPart.Position
newHitbox.Parent = character
CLS:AddTag(newHitbox, "Hitbox")

end

local function characterRemoving(character : Model)
character.Hitbox:Destroy()
end

PS.PlayerAdded:Connect(function(player : Player)
playerConnections[player.Name] = {
CharacterAdded = player.CharacterAdded:Connect(characterAdded),
CharacterRemoving = player.CharacterRemoving:Connect(characterRemoving)
}
end)

PS.PlayerRemoving:Connect(function(player : Player)
playerConnections[player.Name].CharacterAdded:Disconnect()
playerConnections[player.Name].CharacterRemoving:Disconnect()
playerConnections[player.Name] = nil
end)

for i,player in pairs (PS:GetPlayers()) do
playerConnections[player.Name] = {
CharacterAdded = player.CharacterAdded:Connect(characterAdded),
CharacterRemoving = player.CharacterRemoving:Connect(characterRemoving)
}

if (player.Character) then
	characterAdded(player.Character)
end

end

my character doesnt move and the issue is here

for i,player in pairs (PS:GetPlayers()) do
playerConnections[player.Name] = {
CharacterAdded = player.CharacterAdded:Connect(characterAdded),
CharacterRemoving = player.CharacterRemoving:Connect(characterRemoving)
}

if (player.Character) then
	characterAdded(player.Character)
end

end

Please describe your problem further. You can provide related errors from the output, and specific what you want to achieve.


Also, please use ``` to properly display your code.

Like this:
```
code
```

will display as

code

theres no output errors, my character just cant walk n the problem is here

for i,player in pairs (PS:GetPlayers()) do
playerConnections[player.Name] = {
CharacterAdded = player.CharacterAdded:Connect(characterAdded),
CharacterRemoving = player.CharacterRemoving:Connect(characterRemoving)
}

if (player.Character) then
	characterAdded(player.Character)
end
end

How does the character not move? Is it floating in the air (try moving your character using the Move tool while playing. Is it not going down?)? Did it fall down on the floor? Is it standing, but not moving left and right?

let me show you

end

local function characterRemoving(character : Model)
character.Hitbox:Destroy()
end
PS.PlayerAdded:Connect(function(player : Player)
playerConnections[player.Name] = {
CharacterAdded = player.CharacterAdded:Connect(characterAdded),
CharacterRemoving = player.CharacterRemoving:Connect(characterRemoving)
}
end)
PS.PlayerRemoving:Connect(function(player : Player)
playerConnections[player.Name].CharacterAdded:Disconnect()
playerConnections[player.Name].CharacterRemoving:Disconnect()
playerConnections[player.Name] = nil
end)
for i,player in pairs (PS:GetPlayers()) do
playerConnections[player.Name] = {
CharacterAdded = player.CharacterAdded:Connect(characterAdded),
CharacterRemoving = player.CharacterRemoving:Connect(characterRemoving)
}
end

Is your hitbox model anchored?

nope the hitbox belongs to the plant

No, is the hitbox’s Part.Anchored property set to true (in the Properties window)?

No, the hitbox Part.Anchored property is set to unticked

I attempted to reproduce the issue, but no problems occurred. I can also move my character. Your script isn’t the problem, it’s something else (or it could still be your script, just not anywhere in your code snippet.)

Can you send the rest of the code?

I ended up fixing it bro its fine