Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How Do I make this damage anyone but the player using it?


~~~~~~~~~~~~~~~~~



game.StarterPack.Star.RemoteEvent.OnServerEvent:Connect(function(Player)
	script.Parent.Activated:Connect(function()
	--//Fire Script 
	local Part = Instance.new("Part",workspace)
	Part.CFrame = Player.Character.HumanoidRootPart.CFrame*CFrame.new(0,1,-0.1)
	local BodyVelocity = Instance.new("BodyVelocity",Part)
	BodyVelocity.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector*100
	--//Sound
	local Sound = Instance.new("Sound",Part)
	Sound.SoundId = 'rbxassetid://2574670133'
	Sound:Play()
	--//Design
	Part.Size = Vector3.new(0.2,0.2,0.2)
	Part.Transparency = 1
	local Attachment = Instance.new("Attachment",Part)
	Attachment.Name = 'Attachment'
	Attachment.Position = Vector3.new(0, 0, 2)
	local Attachment0 = Instance.new("Attachment",Part)
	Attachment0.Position = Vector3.new(0, 0, 2)
	Attachment0.Name = 'Attachment0'
	local Attachment1 = Instance.new("Attachment",Part)
	Attachment1.Name = 'Attachment1'
	local Particle = Instance.new("ParticleEmitter",Attachment1)
	Particle.Texture = 'rbxassetid://55569290'
	Particle.Lifetime = NumberRange.new(0.03)
	Particle.Rate = 100
	Particle.Size = NumberSequence.new(2)
	local Trail = Instance.new("Trail",Part)
	Trail.Color = ColorSequence.new(Color3.fromRGB(243, 255, 0))
	Trail.Attachment0 = Attachment0
	Trail.Attachment1 = Attachment1
	
	--//Damage
 Part.Touched:Connect(function(hit)
    local Humanoid = hit.Parent:FindFirstChild("Humanoid")
    if Humanoid and Humanoid.Parent.Name ~= Part.Parent.Parent.Name then 
        Humanoid.Health = Humanoid.Health - 10
    end
end)
    
	

	--//Destroy
	wait(3)
	Part:Destroy()
		
		
		
		
	
	end)	
end)~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~

However, the damage does not work it just damages anything for 10 damage? 

5 comments

0

Did you make this?

0

There are community guidelines for how you can ask, and what you should ask about: https://scriptinghelpers.org/help/community-guidelines

0

Explain what has been attempted when posting your question.

0

Attempts should be your own work. Don't take a free model and expect us to fix it.

0

You have already failed on two counts. Either remove this question (if it is a freemodel) or "Explain what has been attempted."

1 answer

✓ Accepted answer

It's better to create an Array of the Players you'd like to be untouched by this piece. Otherwise just define the Username of the Player you don't want to be "hit" here

if Humanoid ~= Player.Character:FindFirstChild("Humanoid") then

Not entirely sure if this will work but try?

This discussion is preserved as it was. New answers, comments, and votes are closed.