Making a script where my sword shoots out an attack and the attack is a random colour picked which then is the sword’s blade’s colour but It results in an error which is the title.
the sword’s damage script
tool.Activated:Connect(function()
attacking = true
handle.UsePartColor = true
handle.Color = script.Parent.BladeValue.Value
wait(attackTime)
handle.UsePartColor = false
attacking = false
debounce = false
end)
the script where it shoots the attack out
local r = math.random(1,255)
local g = math.random(1,255)
local b = math.random(1,255)
if not debounce then
debounce = true
star.Color = Color3.fromRGB(r, g, b)
star.Material = "Neon"
star.Anchored = false
star.CanCollide = false
local spawnPos = script.Parent.Handle.Position
spawnPos = spawnPos + (lookAt * 5)
star.Name = "SoulSwordStar"
local antiGravity = Instance.new("BodyForce")
antiGravity.Force = Vector3.new(0, workspace.Gravity * star:GetMass(), 0)
antiGravity.Parent = star
star.Velocity = lookAt * 100
destroy.Parent = star
dmg.Parent = star
script.Parent.BladeValue.Value = star.Color
star.Parent = workspace
star:SetNetworkOwner((game:GetService("Players"):GetPlayerFromCharacter(character)))
game:GetService("Debris"):AddItem(star, 10)
star.Position = script.Parent.Parent.HumanoidRootPart.Position
wait(0.75)
debounce = false
end
end)
This is the sword’s descendants/children :
Help would be appreciated thank you