I have a script that puts a big shockwave at the players feet when they press x. It works fine, damage is working and it does exactly what I want it to, except the fact that it hurts the user too! I've tried everything I can to make it not damage the user, but I can't seem to make it work, here are the scripts that it uses:
local Player = game.Players.LocalPlayer local mouse = Player:GetMouse() local lastUse = 0; local function onKeyDown(key) local Key = key:lower() if key == "x" and Player.Levelss.Level.Value >= 30 and tick()-lastUse > 10 then local x = Instance.new("Part") x.BrickColor = BrickColor.new("White") x.Material = "Neon" x.CanCollide = false x.Transparency = 0.6 x.Size = Vector3.new(80,1,80) x.TopSurface = "Smooth" x.BottomSurface = "Smooth" x.Shape = "Block" x.Anchored = true x.Name = Player.Name local m = Instance.new("CylinderMesh") m.Parent = x local fd = script.fireDamage:clone() fd.Parent = x local a = Instance.new("Sound") a.SoundId = "http://www.roblox.com/asset/?id=165970126" a.Parent = x a.Volume = 2 a:play() x.CFrame = Player.Character.Torso.CFrame*CFrame.new(0, -2.3 , 0) x.Parent = Workspace game.Debris:AddItem(x, 6) lastUse = tick(); end end mouse.KeyDown:connect(onKeyDown)
Damage (fd) script:
function onDamage(Part) if Part.Parent:FindFirstChild("Humanoid") ~= nil and Part.Parent.Name ~= "script.Parent.Name" then Part.Parent.Humanoid.Health = Part.Parent.Humanoid.Health - script.Damage.Value wait(0.05) end Part.Parent.Humanoid.Sit = true end wait(0.025) script.Parent.Touched:connect(onDamage)
Please help me get to the bottom of this, thanks ^^