CharacterAdded:Connect won't fire

This is a LocalScript

local uis = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local root = char.HumanoidRootPart
local walkNor = hum.WalkSpeed
local JumpNor = hum.JumpPower

local count = 0
local isHoldingV = false
local Debounce = false
local isDash = false
local Movetype = 0
local TauntDebounce = false
local mod1 = false
local mod2 = false
local Keyed = nil

local InCombo = false

local rep = game.ReplicatedStorage
local rme = rep.RemoteEvents


local walk = rep.Animation.Movement.walk
local PlayAnim

local rig = rep.Rig


---For Clone Rig

function weld(main, Target)
	print("ad")
	local weld = Instance.new("Weld", Target)
	weld.Part0 = Target
	weld.Part1 = main
	
end

player.CharacterAdded:Connect(function() -- Reset and rigging when respawn
	print("h")
	local RigClone = rig:Clone()
	RigClone.Parent = char
	
	weld(RigClone["Right Arm"], char["Right Arm"])
	weld(RigClone.Head, char.Head)
	weld(RigClone.Torso, char.Torso)
	weld(RigClone["Left Arm"], char["Left Arm"])
	weld(RigClone["Right Leg"], char["Right Leg"])
	weld(RigClone["Left Leg"], char["Left Leg"])
	
	count = 0
	isHoldingV = false
	Debounce = false
	isDash = false
	Movetype = 0
	TauntDebounce = false

end)

Tired to weld parts from “Rig” when Player’s Character is added to the game (When Joined or Respawned)
Nothing was printed

1 Like

You can not use character added in a local script

1 Like

Events PlayerAdded and CharacterAdded doesn’t working on client only on server.

Try put localScript in StarterCharacterScripts, where character will be:

local Character = script.Parent
print(Character)

The connection fires on my end, but only when the character respawns. The reason why it doesn’t fire on spawn is because of this line:

local char = player.Character or player.CharacterAdded:Wait()

PlayerAdded and CharacterAdded do work on the client.

PlayerAddedd will only fire for other players joining a game, because the connection can only be created after the player has joined.

CharacterAdded might sometimes not fire initially, because the Character can potentially load before the connection can be created, but it will always fire every time after.

3 Likes

Fixed by making it run after certain event instead of on spawn into workspace

thank you for all the explanation