The title says it, i cannot find out what's wrong.
plr = game.Players[script.Parent.Parent.Name] kamehameha = script.Parent kamehameha.Touched:Connect(function(hit) print("touched") if hit.Parent:FindFirstChild("Humanoid") == true then humtodmg = hit.Parent:FindFirstChild("Humanoid") humtodmg.Health = humtodmg.Health - plr.Stats.KiMax/10 end end)
also this script is disabled and it gets undisabled when this script copies it into a part.
blast = Instance.new("Part") blast.Name = "blast" blast.Shape = "Cylinder" blast.BrickColor = BrickColor.new("Toothpaste") blast.Transparency = 0.1 blast.Material = "Neon" blast.CFrame = CFrame.new(ctr.HumanoidRootPart.CFrame.lookVector * 39 + ctr.HumanoidRootPart.CFrame.Position) blast.CFrame = CFrame.new(blast.CFrame.Position, ctr.HumanoidRootPart.CFrame.Position) * CFrame.fromEulerAnglesXYZ(0, math.rad(90), 0) blast.Anchored = true clone2 = clone:Clone() clone2.Parent = blast clone2.Disabled = false clone2 = nil blast.Size = Vector3.new(75,5,5) blast.CanCollide = false blast.Parent = ctr
clone2 is the clone of the script on the top
Roblox parts that are...
- Anchored = true
- CanCollide = false
Do NOT have physics calculated on them. While looking at the DevHub for the .Touched event you can see that it will only fire as a result of physics movement. That may be why its not working. You could try setting anchored = false and trying to use something like a BodyPosition
to keep the blast in place.
Alternatively you could try using Magnitude
and testing the distance between the part and a player, or Region3
and checking to see if the player is inside the area of the blast.
hit.Parent:FindFirstChild("Humanoid") == true is the possible error... Doing if hit.Parent:FindFirstChild("Humanoid") or if not hit.Parent:FindFirstChild("Humanoid") work for sure, unsure if it'd help.