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

How do I click GUI and change torso color?

Asked by 6 years ago

Basically changing torso color

local number = game.StarterPlayer
local player = game.Players.LocalPlayer
local char = player.Character
local torso = char.UpperTorso


if number.Value < 1 then
    number.Value = 1
elseif number.Value > 3 then
    number.Value = 3    
end

script.Parent.MouseButton1Click:connect(function()
    if number.Value < 3 then 
        number.Value = number.Value+1
    elseif number.Value == 3 then
        number.Value = number.Value-2
    end
    if number.Value == 1 then
        torso.Color = Color3.new(255,0,0)
        print("Okay 1")
    elseif number.Value == 2 then
        torso.Color = Color3.new(255,255,0)
        print("Okay 2")
    elseif number.Value == 3 then
        torso.Color = Color3.new(0,0,255)
        print("Okay 3")
    end
end)

It no work Not printing any of Okay's

0
um, StarterPlayer isn't a int value, it is an object theking48989987 2147 — 6y
0
also, color3.new() has to have values between 0 and 1, use color3.fromRGB if you want to use numbers 0-255 theking48989987 2147 — 6y
2
starter player isn't a number and also you should be using body colors, not changing the torso color directly because unless the material is anything other than SmoothPlastic, it won't change the color yellp1 193 — 6y
0
^What they said above, but furthermore you should do player.Character or player.CharacterAdded:Wait() as well as a WaitForChild("UpperTorso") because they may not exist at the creation of the script Vulkarin 581 — 6y
View all comments (2 more)
0
What's number.value? You probably have to specify number.value clearer, and do show us the console errors (if there's any) too. HollowAsherz 0 — 6y
0
It says UpperTorso isn't a valid member of Model Nooblics 0 — 6y

Answer this question