local Player = game:GetService'Players'.LocalPlayer local Colours = script.Parent.Parent:findFirstChild'Colours' local Camera = workspace.Camera local Self = script.Parent local Busy = false local Open = false local ColorChosen -- repeat wait() until Colours for i,Object in next,Camera:GetChildren() do if tostring(Object) == 'Customize' then pcall(function() Object:Destroy() -- can't be too sure that it isn't locked end) end end -- local function rotateCamera() coroutine.resume(coroutine.create(function() local Object = game:GetService'Lighting':findFirstChild'Customize':clone() Object.Parent = Camera local Target = Object:findFirstChild'DatFocus' Camera.CameraSubject = Target local Angle = 0 repeat wait() Camera.CoordinateFrame = CFrame.new(Target.Position) * CFrame.Angles(0,Angle,0) * CFrame.new(0,5,-12) Angle = Angle + math.rad(1) until not Camera:findFirstChild'Customize' Camera.CameraSubject = Player.Character:findFirstChild'Humanoid' Camera.CameraType = 'Custom' end)) end local function updateKart() local Customize = Camera:findFirstChild'Customize' if Customize then local KartPreview = Customize:findFirstChild'KartPreview' for i,Object in next,KartPreview:GetChildren() do if tostring(Object) == "Color1" then Object.BrickColor = Player:findFirstChild'Kart':findFirstChild'KartColor1'.Value elseif tostring(Object) == "Color2" then Object.BrickColor = Player:findFirstChild'Kart':findFirstChild'KartColor2'.Value end end end end -- for i,Object in next,Colours:GetChildren() do if Object:IsA'TextButton' then Object.MouseEnter:connect(function() if Colours:findFirstChild'WhatColor' then Colours:findFirstChild'WhatColor'.Text = tostring(Object) end end) Object.MouseButton1Click:connect(function() Player:findFirstChild'Kart':findFirstChild(ColorChosen).Value = BrickColor.new(tostring(Object)) updateKart() Colours:TweenSizeAndPosition(UDim2.new(),UDim2.new(0.5,0,0.5),"In","Back",0.5) wait(0.47) Colours.Visible = false end) end end Self.MouseButton1Click:connect(function() function Fade(A,B,C) local Transition = script.Parent.Parent:findFirstChild'Transition' for Fade = A,B,C do Transition.BackgroundTransparency = Fade wait() end end function toggleColor(Bool) Self:findFirstChild'Color1'.Visible = Bool Self:findFirstChild'Color2'.Visible = Bool end if not Busy then Busy = true local Transition = script.Parent.Parent:findFirstChild'Transition' for Fade = 1,0,-0.1 do Transition.BackgroundTransparency = Fade wait() end if not Open then Open = true script.Parent.Parent:findFirstChild'Spectate'.Visible = false Self.Position = UDim2.new(0.4, 0, 0, 20) toggleColor(true) rotateCamera() wait() updateKart() elseif Open then Camera:findFirstChild'Customize':Destroy() Open = false Self.Position = UDim2.new(0.5, 0, 0, 20) toggleColor(false) end for Fade = 0,1,0.1 do Transition.BackgroundTransparency = Fade wait() end Busy = false end end) for i,Object in next,Self:GetChildren() do if tostring(Object):lower():find("color") then Object.MouseButton1Click:connect(function() ColorChosen = "Kart" .. tostring(Object) Colours:TweenSizeAndPosition(UDim2.new(0, 256, 0, 256), UDim2.new(0.5, -128, 0.5, -128), "Out", "Back", 0.5) Colours.Visible = true end) end end