-
What do you want to achieve?
I’m trying to create a painting GUI for the player to paint their house however they’d like. -
What is the issue?
My script within the GUI TextButton isn’t working
I’m trying to make it so that when the button is clicked, the part that the player is painting changes to the selected color on their plot & nobody else’s plot. -
What solutions have you tried so far?
I’ve tried searching Youtube videos and the DevForum but I couldn’t find videos/posts specific to the issue I’m having. The Youtube videos weren’t very detailed and went over how to color a part but nothing else.
Right now I’m attempting to create the script for the fence paint—here’s the script & explorer layout below!
Fence Button LocalScript:
local plr = game.Players.LocalPlayer
local PlotClaimed = plr.PlotClaimed
local painting = false
script.Parent.MouseButton1Click:Connect(function()
if PlotClaimed.Value == false then return end
if painting == false then
painting = true
script.Parent.Parent.Parent.Frame.Visible = false
script.Parent.Color.Visible = true
end
end)
Color Button LocalScript:
local plr = game.Players.LocalPlayer
local PlotClaimed = plr.PlotClaimed
local painting = false
script.Parent.MouseButton1Click:Connect(function()
for i ,v in pairs(game.Workspace.PlotFolder:GetDescendants()) do
if v.Name == "PlayerName" and v:IsA("StringValue") then
if v.Value == tostring(plr.Name) then
painting = true
for i ,v in pairs(game.Workspace.PlotFolder:GetDescendants()) do
if v.Name == "Fences" then
local Fences = (v.Parent:FindFirstChild("Fences")
Fences.Color = Color3.fromRGB(218, 253, 255)
end
end
end
end
end
end)
PlotFolder Layout & House:
ClaimPart Script:
if hit.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
if plr and script.Parent.Parent.PlotClaim.Value == false then
local PlotClaimed = plr.PlotClaimed
PlotClaimed.Value = true
script.Parent.Parent.PlayerName.Value = tostring(plr.Name)
script.Parent.Parent.PlayerNamePart.SurfaceGui.PlayerNameLabel.Text = tostring(plr.Name) .. "'s House"
end
end
end)
This is supposed to go along with a placement system I’ve created hence the “DetectPart” is the area in which the player can place the item.
Let me know if you need any more information!