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

Trying to get PlayerGui for a Car Spawner?

Asked by 4 years ago

So basically, I'm making a car spawner. I've already figured out how to spawn the vehicle physically, but I'm currently trying to add some customization options by using an RGB color picker that I found. The color picker is a local script, so to get to it, I have to find it in the PlayerGui. The problem is that I can't access it with a script. So, I know so far that I need to use remoteevents, and I've been looking it up, but I'm just not sure how to do it for my specific script. Any help would be great, thanks!!

My code can be found below.

objectLoc = game.ServerStorage.SPAWNER.CIVI
loc43 = game.workspace.pad1.Position
accessPlayer = game.Players.LocalPlayer.PlayerGui.CIVSPAWN



--local loc45 = game.Workspace.pad2.Position
--local loc46 = game.Workspace.pad3.Position
--local loc47 = game.Workspace.pad4.Position


local function carSpawn(car123)

    local car = car123
    local cloned = car:Clone()
    cloned.Parent = game.Workspace
    cloned:MoveTo(loc43) 
    end

local function carColor(car433)
    local Colour = accessPlayer.Picker["Fill In"].Values.RGB.R.Value.Text
    local Colour1 = accessPlayer.Picker["Fill In"].Values.RGB.G.Value.Text
    local Colour2 = accessPlayer.Picker["Fill In"].Values.RGB.B.Value.Text
    local car2 = car433
    local murder = car2.Body.C2.Color
    local Model = game.ServerStorage:GetChildren()
    for _, Model in pairs(murder:GetChildren()) do
        if Model.Name == "ColorP1" then
            Model.BrickColor = BrickColor.new(Colour, Colour1, Colour2)
        end
    murder.Hood.BrickColor = BrickColor.new(Colour, Colour1, Colour2)
    murder.Trunk.BrickColor = BrickColor.new(Colour, Colour1, Colour2)
    end
end

script.Parent.Frame.VehicleInfoScreen.PSelect.Paint.MouseButton1Click:connect(function(Click)
    game.StarterGui.ScreenGui.Enabled = true
end)


script.Parent.VehicleInfoScreen.STATS.PURCHASE.MouseButton1Click:connect(function(Click)
    carColor(objectLoc.CivCharger2016Dodge)
    wait (0.5)
    carSpawn(objectLoc.CivCharger2016Dodge)

end)

Answer this question