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

How can I make a dialog shop sell cars that don't fall apart?

Asked by 7 years ago
In the roblox tutorials, you have the option to make a dialog shop. The only thing is, In the tutorial they only show you how to add items your character uses to your backpack; so like a sword. I however want to make it sell cars.

Tutorial script.

local dialog = script.Parent
dialog.DialogChoiceSelected:connect(function(player, choice)
    -- Check the player has a stats object
    local stats = player:FindFirstChild('leaderstats')
    if not stats then return end

    -- And that the stats object contains a gold member
    local gold = stats:FindFirstChild('Gold')
    if not gold then return end

    if choice == script.Parent.DialogChoice.ChoiceA then
        if gold.Value >= 5 then -- 5 is the amount of gold you need to purchase this weapon
            game.ReplicatedStorage.Weapon1:Clone().Parent = player.Backpack
            gold.Value = gold.Value - 5 -- subtract the amount of gold you need to purchase
        end
    elseif choice == dialog.DialogChoice.ChoiceB then
        if gold.Value >= 10 then
            game.ReplicatedStorage.Weapon2:Clone().Parent = player.Backpack
            gold.Value = gold.Value - 10
        end
    elseif choice == dialog.DialogChoice.ChoiceC then
        if gold.Value >= 15 then
            game.ReplicatedStorage.Weapon3:Clone().Parent = player.Backpack
            gold.Value = gold.Value - 15
        end
    end
end)

I attempted to modify this...

local dialog = script.Parent
dialog.DialogChoiceSelected:connect(function(player, choice)
    -- Check the player has a stats object
    local stats = player:FindFirstChild('leaderstats')
    if not stats then return end -- If not end script

    -- And that the stats object contains a money member
    local money = stats:FindFirstChild('Money')
    if not money then return end

    if choice == script.Parent.DialogChoice.ChoiceA then
        if money.Value >= 5 then -- 5 is the amount of money you need to purchase this car
            game.ReplicatedStorage.Sportscarblue:Clone().Parent = game.Workspace
            money.Value = money.Value - 5 -- subtract the amount of money you need to purchase
        end
    end
end)

Since I'm still grasping the understand of Cframes and teleportation... I put the car in replicated storage. I then moved the car that was in storage to be positioned over a pad that would be used for a car delivery point. Everything went fine, put when the car is actually spawned, It falls apart into all the parts used to build the model.

So, how can I get a dialog shop to sell a model while keeping the models integrity upon cloning/teleportation?

1 answer

Log in to vote
0
Answered by
Suamy 68
7 years ago

I think you need to weld all the parts of the car together. Try getting a Easy-Weld Plugin. highlight all the parts and weld them together. Welding holds everything together.

I'd also recommend trying to Anchor and Unanchor the car model.

0
I don't think welding would be an issue since the car is together and operational before cloning and has welds. Even the parts that were welded fall apart, I'll try reguardless. Dekadrachm 50 — 7y
0
That didn't do it, Even after another weld job, everything falls apart, including the wheels Dekadrachm 50 — 7y
Ad

Answer this question