so what do i do instead of that?
You just need to have the touched code and the debounce code if this is a bullet, nothing else. The bullet should only detect if something was a shield or not.
If you need to get the player, just use GetPlayerFromCharacter
, a method of the players service, on the Parent of hit
and do stuff with that
what about for this part
if hit.Name == "Shield" then
player.BulletHit.Value -= 1
itâs a value in the player
You use GetPlayerFromCharacter
as I mentioned to get the player via hit.Parent
, it may return nil
if there was no player with that character, so use an if statement to check if what was hit was a character and if not, do nothing.
The article should hae an example of the use of it
Another way you could achieve this is by creating a bool value that detects if the shield is equipped, and if it is, then the player would take no damage(modify the damage script in the gun).
I had this response literally above, feels bad he didnât see it
LMAO feels bad⌠Great minds think alike, though.
That function does not return a player and just waits for a player to join, also it only works once.
Youâll need to connect a PlayerAdded function to get your player.
how do i prevent it from taking damage is my question
On your hit code do
if hit.Parent:FindFirstChild("ShieldActive").Value then
return;
else
DoDamage
end
Yeah, make humanoid.MaxHealth
and humanoid.Health
equal to math.huge()
.
:Wait on RbxScriptSignals waits for something, and then returns it. So in this case, once a player joins, it returns that player.
I mean this is a pretty old thread, but yeah Iâve learned about that.
But I would be connecting a PlayerAdded event instead of calling Wait
.