Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Any Help? Trying To Change Brickcolor Of A Model?

Asked by 7 years ago

Any Idea Why This Does Not Work?

LocalPlayer = game.Players.LocalPlayer Torso = game.LocalPlayer.Torso.BrickColor = ("Really red")

2 answers

Log in to vote
0
Answered by 7 years ago

A better way to write this could be in many ways:

A simple one time coloring:

1local player = game:GetService("Players").LocalPlayer
2player:WaitForChild("Character").Torso.BrickColor = BrickColor.new("Really red")

or a on join module:

1local player = game:GetService("Players").LocalPlayer
2game:GetService("Players").PlayerAdded:connect(function()
3    player:WaitForChild("Character").Torso.BrickColor = BrickColor.new("Really red")

or a module to change the color when it's changed:

01local player = game:GetService("Players").LocalPlayer
02local wfc = game.WaitForChild
03local char = wfc(player,"Character")
04char:FindFirstChild("Torso").Changed:connect(function()
05    if char.Torso.BrickColor == BrickColor.new("Really red") then
06        --still red bro
07    else
08        char.Torso.BrickColor = BrickColor.new("Really red")
09    end
10end)
Ad
Log in to vote
0
Answered by
LeadRDRK 437 Moderation Voter
7 years ago
Edited 7 years ago

You've made a typo. You do not need game.LocalPlayer to direct it to the player since you've already made it local, AND there's no child of game named LocalPlayer. The right way to do it is just simply LocalPlayer. Here's the fixed version

1local LocalPlayer = game.Players.LocalPlayer
2local Torso = LocalPlayer.Character.Torso
3Torso.BrickColor = BrickColor.new("Really red")

Answer this question