local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local tool = script.Parent
local canattack = tool:WaitForChild("CanAttack")
local RightFoot = Instance.new("Part")
local Mouse = plr:GetMouse()
local canswing = true
local mainfire = script.Parent.Moves.Fire
local fire = mainfire:Clone()
tool.Equipped:Connect(function()
char["RightLowerLeg"].Transparency = 1
RightFoot.Name = "Diable"
RightFoot.Transparency = 0
RightFoot.BrickColor = BrickColor.new("Cork")
RightFoot.Material = "Neon"
RightFoot.Reflectance = 0.2
RightFoot.CanCollide = true
RightFoot.Anchored = false
RightFoot.Size = Vector3.new(1, 2, 1)
RightFoot.Parent = char
local w = Instance.new("Weld")
w.Part0 = char["RightLowerLeg"]
w.Part1 = RightFoot
w.Parent = RightFoot
fire.Parent = RightFoot
fire.Enabled = true
local start = plr.Character.Humanoid:LoadAnimation(script.Start)
start:Play()
end)
tool.Activated:Connect(function()
if canswing == true then
canswing = false
canattack.Value = true
local choose = math.random(1,2)
if choose == 1 then
local swing1animation = plr.Character.Humanoid:LoadAnimation(script.Kick1)
swing1animation:Play()
wait(1)
canswing = true
elseif choose == 2 then
local swing2animation = plr.Character.Humanoid:LoadAnimation(script.Kick2)
swing2animation:Play()
wait(1)
canswing = true
end
end
end)
tool.Unequipped:connect(function()
RightFoot.Transparency = 1
fire.Enabled = false
char["RightLowerLeg"].Transparency = 0
local hum = char:WaitForChild("Humanoid")
local fin = plr.Character.Humanoid:LoadAnimation(script.Stop)
fin:Play()
end)
The script works PERFECTLY when I use it but then I die and it doesn't seem to work AT ALL
Please help I just don't get why its not working and I've spent hours trying to fix it
and also this is a combat script to deal punches and such and theres a separate damage script that works just fine but the damage script isn't a local script

1 comment
Char will only correlate to the existing character declared at that point in time. After an avatar is disjointed, a fresh rig is loaded. You have to compensate for this: call Player.Character instead of allocating a static variable