When I attack the other player, the other player gains pins and I don't. I want the other player to gain pins when he's attacking me and I want to gain pins when I'm attacking him. Are there any problems on this script? Thanks! ~ BlackHatRBX
local CanDamagePlayers = true script.Parent.Blade.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and CanDamagePlayers == true and hit.Parent.Humanoid.Health > 1 then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) local pins = plr:WaitForChild("leaderstats").Pins pins.Value = pins.Value + 15 hit.Parent.Humanoid:TakeDamage(script.Parent.Damage.Value) script.Parent.Sound:Play() hit.Parent.Humanoid.PlatformStand = true CanDamagePlayers = false wait(0.5) CanDamagePlayers = true wait(1) hit.Parent.Humanoid.PlatformStand = false end end)
local CanDamagePlayers = true
script.Parent.Blade.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") and CanDamagePlayers == true and hit.Parent.Humanoid.Health > 1 then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent) local pins = plr:WaitForChild("leaderstats").Pins pins.Value = pins.Value + 15
hit.Parent.Humanoid:TakeDamage(script.Parent.Damage.Value)
script.Parent.Sound:Play()
hit.Parent.Humanoid.PlatformStand = true CanDamagePlayers = false wait(0.5) CanDamagePlayers = true wait(1) hit.Parent.Humanoid.PlatformStand = false end end)
"local plr = game.Players:GetPlayerFromCharacter(hit.Parent)" This line right here gets whatever you hit's parent not yourself. If you want yourself then you do the parent of the blade's name and then you call :GetPlayerFromCharacter. Sorry if you already figured this out, but they didn't reply to your comments