i need help with an error, when making my projectile it keeps saying, 23:54:35.755 Argument 1 missing or nil, and i've tried to fix the problem many times but it wouldnt work.
script.Parent.RemoteEvent.OnServerEvent:Connect(function(player, character)
local char = player.Character or player.CharacterAdded:Wait()
local root = character:WaitForChild("HumanoidRootPart")
local fbtime = 4
local MuseProjectile = game.ReplicatedStorage.Part:Clone()
MuseProjectile.Parent = workspace
MuseProjectile.CFrame = root.CFrame * CFrame.new (0,0,-2)
game.Debris:AddItem(MuseProjectile, fbtime)
local bodyvel = Instance.new("BodyVelocity")
bodyvel.MaxForce = Vector3.new(1e8, 1e8,1e8)
bodyvel.Velocity = root.CFrame.LookVector * 80
bodyvel.Parent = MuseProjectile
local debounce = false
MuseProjectile.Touched:Connect(function(hit)
if hit.isDescendantOf(char) then
return
end
if hit.Parent:IsA("Accoutrement") then
hit = hit.Parent
end
local enemyhumanoid = hit.Parent:WaitForChild("Humanoid")
local enemyroot = hit.Parent:WaitForChild("HumanoidRootPart")
if enemyhumanoid and not debounce then
debounce = true
MuseProjectile:Destroy()
local HitM = game.ReplicatedStorage.Fire:Clone()
HitM.Parent = enemyroot
spawn(function()
wait(.5)
HitM.Enabled = false
wait(.6)
HitM.Destroy()
end)
enemyhumanoid:TakeDamage(25)
wait()
debounce = false
end
end)
end)

1 comment
Learn to format your code and share the full output properly for assistance.