✓ Accepted answer
If your script is inside of "StarterCharacterScripts" then it runs when your character spawns, in your script you use [PlayerAdded] signal which fires when player joins, it is nonsense, in your case the best fix would be putting this script inside of "ServerScriptService", there it will run somewhere at the server start.
You also should be using [WaitForChild] to be sure that [Char.Torso] is replicated because it does not have to be when you index it right after he spawns:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Char)
game.ReplicatedStorage.Auras.Lightning:Clone().Parent = Char:WaitForChild("Torso")
end)
end)
This should fix it, for maximum efficiency tho you should use variables to not index [...Auras.Lighting] everytime the character spawns.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Lighting = ReplicatedStorage.Auras.Lighting
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Char)
Lighting:Clone().Parent = Char:WaitForChild("Torso")
end)
end)
2 comments
Is your character r6
Yes