local rs = game:GetService("ReplicatedStorage")
local parent = script.Parent
local touched = false
parent.Touched:Connect(function(hit)
touched = true
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum and touched then
local Bat = rs:FindFirstChild("Weapons"):FindFirstChild("Bat")
if Bat then
local batclone = Bat:Clone()
batclone.Parent = hit.Parent
local hrp = hit.Parent:FindFirstChild("HumanoidRootPart")
local torso = hum:FindFirstChild("Torso")
if hrp then
-- Calculate the position in front of the player
local Pos = hrp.Position + hrp.CFrame.LookVector * 5
-- Create a CFrame with the position and flat orientation
local Flatmode = CFrame.new(Pos) * CFrame.Angles(math.rad(hrp.CFrame.RightVector), math.rad(0), math.rad(0))
-- Set the bat's primary part CFrame to this new CFrame
batclone.CFrame = Flatmode
local weld = Instance.new("WeldConstraint")
weld.Part0 = batclone
weld.Part1 = hrp
weld.Parent = batclone
end
end
end
end)