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

Script that changes text's color and text's textstroke color not working. What's the problem?

Asked by
ghxstlvty 133
4 years ago
script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Parent.Shop.Visible = false
    script.Parent.Parent.Parent.ChangeTeam.Visible = true
        script.Parent.TextColor3 = Color3.new(255, 52, 52)
    script.Parent.TextStrokeColor3 = Color3.new(255, 52, 52)
            script.Parent.Parent.Shop.TextColor3 = Color3.new(255, 255, 255)
    script.Parent.Parent.Shop.TextStrokeColor3 = Color3.new(255, 255, 255)
                script.Parent.Parent.Credits.TextColor3 = Color3.new(255, 255, 255)
    script.Parent.Parent.Credits.TextStrokeColor3 = Color3.new(255, 255, 255)
end)

No error codes shows

Explorer: https://prnt.sc/ty5zjq

1 answer

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

Hello.

The reason as to why your script isn't working is because you are using Color3.new instead of Color3.fromRGB. Color3.fromRGB is used for GUIS, as for Color3.new is used for other things, also you have defined the wrong Shop. you have defined the Shop frame instead of the Shop button. Because the Shop frame isn't a TextButton, it doesn't have the functions of a TextButton, which in your case, are TextColor3 and TextStrokeColor3. I suggest defining the items instead of using Parent climbs, just to make sure that what you are defining is correct, and it's also tidier! I have fixed the script for you, tested it and everything worked like it should've.

local Player = game:GetService("Players").LocalPlayer
 local PlayerGui = Player:WaitForChild("PlayerGui")
   local GUI = PlayerGui.Main
    local Button = script.Parent
   local Shop = script.Parent.Parent.Shop
  local ChangeTeam = GUI.Frame.ChangeTeam
local Credits = script.Parent.Parent.Credits

Button.MouseButton1Click:Connect(function()
 Shop.Visible = false
  ChangeTeam.Visible = true
   Button.TextColor3 = Color3.fromRGB(255, 52, 52)
   Button.TextStrokeColor3 = Color3.fromRGB(255, 52, 52)
  Shop.TextColor3 = Color3.fromRGB(255, 255, 255)
 Shop.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
Credits.TextColor3 = Color3.fromRGB(255, 255, 255)
    Credits.TextStrokeColor3 = Color3.fromRGB(255, 255, 255)
end)

Hope this has helped you, if so, feel free to accept my answer, or, if you have any questions, feel free to ask them in the comments below!

0
Makes the shop button disappear and the button color and textstroke color stays white. ghxstlvty 133 — 4y
0
Oh sorry! I have forgotten something, let me edit my answer RazzyPlayz 497 — 4y
0
No worries. ghxstlvty 133 — 4y
0
Okay, I have edited the answer, hopefully that will work! RazzyPlayz 497 — 4y
View all comments (2 more)
0
Had to change a few things but it all worked out in the end, thank you! ghxstlvty 133 — 4y
0
No problem! RazzyPlayz 497 — 4y
Ad

Answer this question