essentially the melee attack isnt doing anything i press e and nothing happens its like the script doesnt run
--//Titan Shift
script.Parent.Shift.OnServerEvent:Connect(function(Player)
NewChar = game.ReplicatedStorage.BasicAttackTitan:Clone()
local Pos = Player.Character:GetPrimaryPartCFrame()
Player.Character:Destroy()
Player.Character = NewChar
NewChar.Parent = workspace
NewChar:SetPrimaryPartCFrame(Pos)
end)
--//Melee Attack
local Attack1 = script.Attack1
local Attack2 = script.Attack2
local ComSeq = 1
local anim
local Hitbox = game.ServerStorage.HitBox
script.Parent.Melee.OnServerEvent:Connect(function()
print(NewChar)
local hum = NewChar.Humanoid
local Humrp = NewChar.HumanoidRootPart
local anim1 = hum:LoadAnimation(Attack1)
local anim2 = hum:LoadAnimation(Attack2)
if ComSeq == 1 then
anim = anim1
ComSeq = 2
elseif ComSeq == 2 then
anim = anim2
ComSeq = 1
end
anim:Play()
local HitboxNew = Hitbox:Clone()
local Weld = Instance.new("WeldConstraint")
Weld.Parent = Humrp
Weld.Part0 = Humrp
Weld.Part1 = HitboxNew
HitboxNew.CFrame = Humrp.CFrame * CFrame.new(0,0,-3)
HitboxNew.Parent = Humrp
local touchConn
touchConn = HitboxNew.touched:Connect(function(hit)
if hit.Parent.Name ~= NewChar.Name and hit.Parent.Humanoid then
HitboxNew:Destroy()
Weld:Destroy()
hum.Health -= 100
end
end)
wait(0.5)
if touchConn ~= nil then touchConn:Disconnect() end
Weld:Destroy()
HitboxNew:Destroy()
end)

1 comment
how can this be true though? it says onserverevent meaning its in a server script