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

How do I make a part's color become the color of a backgroundcolor3 in a textbutton?

Asked by 3 years ago
So basically i am trying to make this GUI where you can insert parts, change its color and position. But I keep getting this error that says, "Color is not a valid member of textbutton." Anyways here are my 2 scripts

-- local script local buildingGUI = script.Parent local BuildingFrame = buildingGUI:WaitForChild("BuildingFrame") local CreatePartButton = BuildingFrame.CreatePartButton local ColoringFrame = buildingGUI.ColoringFrame local ReplicatedStorage = game:GetService("ReplicatedStorage") local BuildObjects = ReplicatedStorage:WaitForChild("BuildObjects") local canMovePart = false local part = BuildObjects.Part local mouse = game:GetService("Players").LocalPlayer:GetMouse() local BuildEvent = ReplicatedStorage.RemoteEvents.BuildEvent CreatePartButton.MouseButton1Click:Connect(function() local clonedPart = part:Clone() clonedPart.Parent = game.Workspace clonedPart.Transparency = 0.7 clonedPart.Position = mouse.Hit.p ColoringFrame.Visible = true for i, v in pairs(ColoringFrame:GetChildren()) do if v:IsA("TextButton") then v.MouseButton1Click:Connect(function() local selectedColor = v local backGroundColor = v.BackgroundColor3 clonedPart.Parent = game.Workspace clonedPart.Position = mouse.Hit.p mouse.Move:Connect(function() if canMovePart == false then clonedPart.Position = mouse.Hit.p mouse.Button1Down:Connect(function() local finalPartPosition = mouse.Hit.p BuildEvent:FireServer(backGroundColor,selectedColor,clonedPart,finalPartPosition) canMovePart = false end) end end) end) end end end)
-- server script


local ReplicatedStorage = game:GetService("ReplicatedStorage")

local RemoteEvents = ReplicatedStorage.RemoteEvents
local buildEvent = RemoteEvents:WaitForChild("BuildEvent")

buildEvent.OnServerEvent:Connect(function(backGroundColor,selectedColor,clonedPart,finalPartPosition)
    clonedPart.Color = Color3.new(backGroundColor)
    clonedPart.Position = finalPartPosition
    clonedPart.Transparency = 0

    clonedPart.Parent = game.Workspace
end)


0
the error appears in the script or local script? daokhiethy 25 — 3y
0
the script noelgamer212313 5 — 3y

1 answer

Log in to vote
0
Answered by
Necro_las 412 Moderation Voter
3 years ago
Edited 3 years ago

The error means that your clonedPart is a TextButton, and you tried to set TextButton.Color on line 10 of the server script, but the object does not have this property. Probably you want to change BackgroundColor or TextColor

Ad

Answer this question