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

How can I get this Bullet script to work?

I have this script:

Bullet.BrickColor=BrickColor.new("New Yeller")

That makes the bullet that come out Yellow, I am trying to make it change the bullet color to your team color and cant find out how to do that. If you can, could you help me with that task?

2 answers

✓ Accepted answer

That depends whether your script is local or server-sided, although a local script is recommended to use.

If it's local-sided, you would simply use LocalPlayer.

Bullet.BrickColor = game.Players.LocalPlayer.TeamColor

If it's server-sided, you use the :GetPlayerFromCharacter() method.

Bullet.BrickColor = game.Players:GetPlayerFromCharacter(script.Parent.Parent).TeamColor

script.Parent.Parent assumes that script.Parent is the tool, and the parent of that is the character.

Well, when working with anything that will be inside a Player, you should use a LocalScript. Now you can simply get the Player with game.Players.LocalPlayer

workspace.Part.BrickColor = game.Players.LocalPlayer.TeamColor

1 comment

0

Thanks man I appreciate it!

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