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

What's wrong with this script? {Unanswered}

Asked by 10 years ago
Car = game.Workspace["Nissan 240SX(Car)"]

function OnTouched(hit)
    if game.Players:GetPlayerFromCharacter(hit.Parent) then
        for _,Player in pairs(game.Players:GetPlayers()) do
        if Player:FindFirstChild("leaderstats") then
    if Player.leaderstats.Money.Value > 68000 then do
            Player.leaderstats.Money.Value = Player.leaderstats.Money.Value -68000
            if game.Players:GetPlayerFromCharacter(script.Parent)then do
            local Clone = Car:Clone()
            Clone.Anchored = false
            Clone.Position = Vector3.new(-24, 9.2, -874)
            Clone.Parent = game.Workspace
            Clone.Anchored = true
            wait(2)
            Clone.Anchored = false
            end
            end
            end
            end
        end
        end
    end
end


script.Parent.Touched:connect(OnTouched)

What i'm trying to do is when you step on the button, it only takes 68000 out of your money and spawn the car at its coordinates.

Mistake:

1) It doesn't spawn the copied car at its coordinates.

All help would be gladly appreciated. Thanks!

1 answer

Log in to vote
0
Answered by 10 years ago

pairs

0
What do you mean? notes4u99 65 — 10y
Ad

Answer this question