i want to make a script when it hits a player that player get bluer but idk how do i get all the player ib game
I'm not sure what you mean by "not just local player" as server scripts cannot get the local player but to get the player that is hit, first create a on touched event:
script.Parent.Equipped:Connect(function() equipped = true char = script.Parent.Parent humanoid = char:FindFirstChild("Humanoid") end) script.Parent.Unequipped:Connect(function() equipped = false char = nil humanoid = nil end) script.Parent.Handle.Touched:Connect(function(hit) if hit and equipped and char and humanoid and humanoid.Health > 0 then local targetHum = hit.Parent:FindFirstChild("Humanoid") if targetHum then end end end)
this checks if the tool is equipped, if the player character exists, and if the humanoid exists then checks if it hit something w/ a humanoid like a zombie or a player then:
local dmg = 15 script.Parent.Equipped:Connect(function() equipped = true char = script.Parent.Parent humanoid = char:FindFirstChild("Humanoid") end) script.Parent.Unequipped:Connect(function() equipped = false char = nil humanoid = nil end) script.Parent.Handle.Touched:Connect(function(hit) if hit and equipped and char and humanoid and humanoid.Health > 0 then local targetHum = hit.Parent:FindFirstChild("Humanoid") if targetHum then local HitChar = targetHum.Parent targetHum:TakeDamage(dmg) if HitChar then for _,v in pairs(HitChar:GetChildren()) if v:IsA("BasePart") then v.Color = Color3.fromRGB(9, 137, 207) end end end end end end)
so this also damages the humanoid that was hit and cycles through all parts of the character that was hit and if it is a base part, (mesh part, truss part, corner wedge, etc.), then changes the color of it to blue.