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 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)
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)
2 comments
the error appears in the script or local script?
the script