local gladius = game:GetService("ReplicatedStorage").Weapons.Gladius
local Players = game:GetService("Player")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
print("Hi")
local upperTorso = character:WaitForChild("UpperTorso")
local gladiusClone = gladius:Clone()
gladiusClone.Parent = character
local handle = gladiusClone:WaitForChild("Handle")
local motor = Instance.new("Motor6D")
motor.Name = "WeaponWeld"
motor.Parent = upperTorso
motor.Part0 = upperTorso
motor.Part1 = handle
motor.C0 = CFrame.new(0,2.4,.75) * CFrame.Angles(89.5,0,0)
print("Hi")
end)
end)
Sometimes the CharacterAdded event fires and sometimes it doesnt? How can I make the event fire when the player joins? (This is a server script)
Super odd name, why is it Player
and not Players
?
Anyways, it could be possible that your event didn’t fire before client was added? That’s nearly impossible. Other than the aforementioned, there is no other reason it couldn’t have fired.
2 Likes
I believe it’s just a mistypo, Player
would result as an error since that’s not a valid Service name while getting a specific Service, but Players
is
This should be the fixed script hopefully?
local gladius = game:GetService("ReplicatedStorage").Weapons.Gladius
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
print("Hi")
local upperTorso = character:WaitForChild("UpperTorso")
local gladiusClone = gladius:Clone()
gladiusClone.Parent = character
local handle = gladiusClone:WaitForChild("Handle")
local motor = Instance.new("Motor6D")
motor.Name = "WeaponWeld"
motor.Parent = upperTorso
motor.Part0 = upperTorso
motor.Part1 = handle
motor.C0 = CFrame.new(0,2.4,.75) * CFrame.Angles(89.5,0,0)
print("Hi")
end)
end)
1 Like
Yeah it was cause of the typo haha. Thank you!