I made a script so that an aura would be given after death, but the cap does not give me an aura after death.
game.Players.PlayerAdded:Connect(function(player)
wait(1) -- Wait for a moment to ensure everything is set up
player.CharacterAdded:Connect(function(character)
print("Add Aura") -- Debug message for character spawn
-- Check for leaderstats and Class
if player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("Class") then
local className = player.leaderstats.Class.Value
print("Class Name: " .. className) -- Debug output for the player's class
-- Convert the class name, removing any dashes
local auraClassName = className:gsub("-", "") -- Replace dashes with an empty string
print("Aura Class Name: " .. auraClassName) -- Debug output for the aura class name
local aura = game.ServerStorage.Powers.Auras:FindFirstChild(auraClassName) -- Find the corresponding aura
if aura then
print("Aura found for class: " .. auraClassName) -- Confirm aura was found
local clonedAura = aura:Clone() -- Clone the aura
clonedAura.Parent = character -- Set the parent to the character
-- Attach aura parts to the character
for _, part in pairs(clonedAura:GetChildren()) do
if character:FindFirstChild(part.Name) then
part.Parent = character[part.Name] -- Parent part to the character's corresponding part
else
warn("Part " .. part.Name .. " not found in character.") -- Warn if part is not found
end
end
else
warn("Aura for class " .. auraClassName .. " not found.") -- Warn if aura is not found
end
else
warn("Leaderstats or Class not found for player: " .. player.Name) -- Warn if leaderstats or class is missing
end
end)
end)
You can try setting the position of aura parts to the position of the character and that should work.
game.Players.PlayerAdded:Connect(function(player)
wait(1) -- Wait for a moment to ensure everything is set up
player.CharacterAdded:Connect(function(character)
print("Add Aura") -- Debug message for character spawn
-- Check for leaderstats and Class
if player:FindFirstChild("leaderstats") and player.leaderstats:FindFirstChild("Class") then
local className = player.leaderstats.Class.Value
print("Class Name: " .. className) -- Debug output for the player's class
-- Convert the class name, removing any dashes
local auraClassName = className:gsub("-", "") -- Replace dashes with an empty string
print("Aura Class Name: " .. auraClassName) -- Debug output for the aura class name
local aura = game.ServerStorage.Powers.Auras:FindFirstChild(auraClassName) -- Find the corresponding aura
if aura then
print("Aura found for class: " .. auraClassName) -- Confirm aura was found
local clonedAura = aura:Clone() -- Clone the aura
clonedAura.Parent = character -- Set the parent to the character
-- Attach aura parts to the character
for _, part in pairs(clonedAura:GetChildren()) do
if character:FindFirstChild(part.Name) then
part.Parent = character[part.Name] -- Parent part to the character's corresponding part
part.Position = character[part.Name].Position
else
warn("Part " .. part.Name .. " not found in character.") -- Warn if part is not found
end
end
else
warn("Aura for class " .. auraClassName .. " not found.") -- Warn if aura is not found
end
else
warn("Leaderstats or Class not found for player: " .. player.Name) -- Warn if leaderstats or class is missing
end
end)
end)
The error you are getting is because a particle emitter doesnt have a position, its position is locked to the part in which is place, so when you are calling part.Position which part being a particle emitter you arent doing nothing. I suggest you to instead of setting the position to the character, just directly insert the particle emitter to it.
For debugging purposes try parenting the Particle Emitter to some part in the workspace and see if it is emitting particles. If it is not emitting particles then you may want to check if the Particle Emitter is enabled and also you might have to try changing some of the settings of the particle emitter.