Currently my scriptI wrote to change teams is not working, here is what it looks like:
(line 1) local plr = game.Players.LocalPlayer (line 2) script.Parent.Mousebutton1Click:Connect(function() (line 3) plr.TeamColor = BrickColor.new.('Rust') (line 4) wait (1) (line 5) plr.Health = 0 (line 6) end)
I've never seen this many errors in somebody's code in a long long time.
But anyways the first error is on line 2 you typed MouseButton1Click
with a lowercase b.
It should be like this:
script.Parent.MouseButton1Click:Connect(function()
The second error is that on line 3 you messed up on BrickColor.new
. You used a single apostrophe instead of two. You also added an additional dot after .new.
It should be like this:
plr.TeamColor = BrickColor.new("Rust")
The third error is on line 5. There is not a health property inside of the player class on Roblox. Although, there is a health property inside of the players Humanoid. To fix this you would simply replace it with the following:
plr.Character.Humanoid.Health = 0
The FOURTH error is that you are not defining what the variable plr
is calling. You are going to want to insert a new line of code at the very top of the script and make it the following:
plr = game.Players.LocalPlayer
Anyways, hopefully this helped.
1) Your first error is on line 2, you put script.Parent.Mousebutton1Click, you messed up on the spelling it should be a capital B script.Parent.MouseButton1Click
2) Your second error is on line 5, doing plr.health will not get the health you would have to plr.Character.Health = 0
Here is what I have done and I tested it to make sure it works!
local plr = game.Players.LocalPlayer NewTeamColor = "Rust" function TeamChange() plr.TeamColor = BrickColor.new(NewTeamColor) wait(1) plr.Character.Humanoid.Health = 0 end script.Parent.MouseButton1Click:Connect(TeamChange)