I am acctually making a monster magic script, but the function "Touch" Doesnt Works. Can somebody help me?
function Attack(target,char)
local bluebone = game.Lighting.Assets.BlueBone:Clone()
game:GetService("Debris"):AddItem(bluebone,3)
bluebone.HumanoidRootPart.Anchored = true
bluebone.Parent = workspace
bluebone.HumanoidRootPart.CFrame = char.Parent.e2.CFrame + Vector3.new(0,-5,0)
for i = 1, 10 do
bluebone.HumanoidRootPart.CFrame = CFrame.new(bluebone.HumanoidRootPart.Position + Vector3.new(-1,0,0))
wait()
end
local connection = nil
local function Touch(h)
if h.Parent:FindFirstChild("Humanoid") and h.Parent:FindFirstChild("_enemytag") == nil and h.Parent == game.Players.LocalPlayer.Character then
game.Lighting.Damage:FireServer(script.Name,h.Parent.Humanoid)
print("works")
end
if not h.Parent:IsA("Accoutrement") then
bluebone:Destroy()
connection:Disconnect()
print("works")
end
end
connection = bluebone.HumanoidRootPart.Touched:Connect(Touch)
return Attack
end
