You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
-
What is the issue? Include screenshots / videos if possible!
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
module.Spit = function(boss, dmg)
local filter = RaycastParams.new()
filter.FilterDescendantsInstances = {boss}
filter.FilterType = Enum.RaycastFilterType.Blacklist
local attack = workspace:Raycast(
boss.Position,
boss.CFrame.LookVector * 45,
filter
)
local m = Instance.new("Part")
m.Anchored = true
m.Parent = workspace
m.Position = boss.CFrame.LookVector * 50
if attack then
local humanoid = attack.Instance.Parent:FindFirstChild("Humanoid") or attack.Instance.Parent.Parent:FindFirstChild("Humanoid")
if humanoid then
spawn(function()
for i = 1, 3, 1 do
wait(1.5)
humanoid.Health -= dmg
end
end)
else
local puddle = script.Puddle:Clone()
puddle.Parent = workspace
puddle.Position = attack.Position
end
else
warn("[Spit]: No instance found")
end
end
For some reason attack is nil at some times and I don’t know how to fix it or what’s wrong with it
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.