My hitbox is in the wrong position I just want to know how I can fix it
Client Side:
local anim = script.Animation
local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local hum = Char:WaitForChild("Humanoid")
local Track = hum:LoadAnimation(anim)
local UIS = game:GetService("UserInputService")
local PunchEvent = game.ReplicatedStorage.PunchEvent
local db = false
UIS.InputBegan:Connect(function(input,proc)
if proc then
return
end
if input.UserInputType == Enum.UserInputType.MouseButton1 and not db then
db = true
PunchEvent:FireServer()
Track:Play()
wait(1)
db = false
end
end)
Server Side:
game.ReplicatedStorage.PunchEvent.OnServerEvent:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
local HRP = char:WaitForChild("HumanoidRootPart")
local Hitbox = Instance.new("Part")
Hitbox.Parent = game.ReplicatedStorage
local HitboxClone = Hitbox:Clone()
HitboxClone.Parent = workspace
HitboxClone.Size = Vector3.new(4.1, 3.98, 2.78)
HitboxClone.Position = HRP.CFrame.Position + Vector3.new(5,0,0)
HitboxClone.Transparency = 0.5
HitboxClone.Color = Color3.new(1,0,0)
HitboxClone.Anchored = true
HitboxClone.CanCollide = false
wait(0.5)
HitboxClone:Destroy()
end)