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

can someone for the life of me tell me at least what is wrong with this script?

Asked by 6 years ago

I've been trying for literally 3 hours now and i'm probably the stupidest person in this place right now but what am I doing wrong with this script???

local h = script.Parent.Parent.Parent.edit_label.Part.Value
local d = game.Players.LocalPlayer.Data
local c = script.color.Value
local n = script.Parent.Name
local head = script.Parent.Parent.Parent.Hat
local torso = script.Parent.Parent.Parent.Torso
local larm = script.Parent.Parent.Parent.Larm
local rarm = script.Parent.Parent.Parent.Rarm
local lleg = script.Parent.Parent.Parent.Lleg
local rleg = script.Parent.Parent.Parent.Rleg

script.Parent.MouseButton1Click:connect(function()
    if h == "head" then
        head.BackgroundColor3 = Color3.fromRGB(c)
        d.headcolor = n
    if h == "torso" then
        torso.BackgroundColor3 = Color3.fromRGB(c)
        d.torsocolor = n
    end
    end
end)

this is a fraction of the script and it wont even work, but what it is supposed to do is check which part of the body the player is editing and if it is that part of the body to change that color, but every time I do this it will only change the head or change nothing.

if anyone can actually fix this I will praise you.

0
Do you want to change the vars "h,n,c" during the game? If yes, you should set it on player click Leamir 3138 — 6y
0
I suggest you clean up your variables by creating a new one that points to script.Parent.Parent.Parent directly. T0XN 276 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Now to fix the entire script, we would need you to produce the entire script. But for now, this should fix this element of the script.

local h = script.Parent.Parent.Parent.edit_label.Part.Value
local d = game.Players.LocalPlayer.Data
local c = script.color.Value
local n = script.Parent.Name
local head = script.Parent.Parent.Parent.Hat
local torso = script.Parent.Parent.Parent.Torso
local larm = script.Parent.Parent.Parent.Larm
local rarm = script.Parent.Parent.Parent.Rarm
local lleg = script.Parent.Parent.Parent.Lleg
local rleg = script.Parent.Parent.Parent.Rleg

script.Parent.MouseButton1Click:Connect(function()
    if h == "head" then
        head.BackgroundColor3 = Color3.fromRGB(c)
        d.headcolor = n
    elseif h == "torso" then
        torso.BackgroundColor3 = Color3.fromRGB(c)
        d.torsocolor = n
    end
end)

Also don't use :connect, it's depreciated, use :Connect.

0
it still turns the head color to black when I click the torso VeryDarkDev 47 — 6y
Ad

Answer this question