You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I’ve made a car color customization script based of a Youtube Video. It displays a color customization gui when passing thru a certain part. The script works for most of the cars besides like 5-6 on the server. I want it to work for all cars. Also I would kind of like to change pre set colors to a color slider but that’s after i fix my current problem xD -
What is the issue? Include screenshots / videos if possible!
^^^
This is the Ui being displayed when passing thru the block
^^^
This is where cars Spawned from the Dealership script go to
^^^
Here is a video of the location of the scripts/ it working/not working -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried changing the code to cloning the ui to all players passed thru but then it outputs when i try to change colors that no vehicles have been provided from the GiveUI script. I’ve tried editing the car files to ensure the driveseat name is in the same position but it is in all cars. (the cars having issues are all made by the same person)
Here is the code/location of the code. As well as a car that works on one that does not.
This car works
This car does not.
All help is greatly appreciated. Sorry for the lengthy post but wanted to provide all information I have. I’ve been trying all week and I’m at a loss, may end up hiring someone on fiver to fix it
Can provide a world file to anyone that wants to try it out. It wouldn’t let me upload it here for some reason.
GiveUI code
local ui = script.ColorUI
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("DriveSeat") then
local occupant = hit.Parent:FindFirstChild("DriveSeat").Occupant
if occupant and occupant.Parent and game.Players:GetPlayerFromCharacter(occupant.Parent) then
local player = game.Players:GetPlayerFromCharacter(occupant.Parent)
local playerGui = player.PlayerGui
if not playerGui:FindFirstChild("ColorUI") then
print("Creating UI for player:", player.Name)
local a = ui:Clone()
a.Car.Value = hit.Parent
a.Parent = playerGui
print("UI cloned and added to PlayerGui for:", player.Name)
else
print("Player already has ColorUI in their PlayerGui.")
end
else
print("Could not find player for occupant:", occupant)
end
else
print("No DriveSeat found in touched part.")
end
end)
Color Management Code
local event = game.ReplicatedStorage.Colors:WaitForChild("RemoteEvent")
script.Parent.RedMain.MouseButton1Click:Connect(function()
event:FireServer(script.Parent.Car.Value,"Bright red")
end)
script.Parent.WhiteMain.MouseButton1Click:Connect(function()
event:FireServer(script.Parent.Car.Value,"White")
end)
script.Parent.BlackMain.MouseButton1Click:Connect(function()
event:FireServer(script.Parent.Car.Value,"Black")
end)
script.Parent.BlueMain.MouseButton1Click:Connect(function()
event:FireServer(script.Parent.Car.Value,"Bright blue")
end)
script.Parent.YellowMain.MouseButton1Click:Connect(function()
event:FireServer(script.Parent.Car.Value,"Bright yellow")
end)
script.Parent.OrangeMain.MouseButton1Click:Connect(function()
event:FireServer(script.Parent.Car.Value,"Bright orange")
end)
script.Parent.GreyMain.MouseButton1Click:Connect(function()
event:FireServer(script.Parent.Car.Value,"Light gray")
end)
script.Parent.PurpleMain.MouseButton1Click:Connect(function()
event:FireServer(script.Parent.Car.Value,"Bright violet")
end)
script.Parent.GreenMain.MouseButton1Click:Connect(function()
event:FireServer(script.Parent.Car.Value,"Lime green")
end)
local uiEvent = game.ReplicatedStorage.Colors:WaitForChild("UIEvent")
script.Parent.Exit.MouseButton1Click:Connect(function()
uiEvent:FireServer()
end)
EventHandler Code
local event = game.ReplicatedStorage.Colors:WaitForChild("RemoteEvent")
local function ChangeColor(plr, vehicle, colorToChange)
for i, v in pairs(vehicle.Body:GetChildren()) do
if v.Name == "Paint" then
v.BrickColor = BrickColor.new(colorToChange)
end
end
end
event.OnServerEvent:Connect(ChangeColor)
local uiEvent = game.ReplicatedStorage.Colors:WaitForChild("UIEvent")
local function UIChange(plr)
local ui = plr.PlayerGui:FindFirstChild("ColorUI")
if ui then
ui:Destroy()
end
end
uiEvent.OnServerEvent:Connect(UIChange)