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

i want a script that gives the player money whilst driving? [closed]

Asked by 4 years ago

hello i am trying to make a script that when you drive it gives you money but i am having trouble finding the (working) script for it. . . either i am not setting up the script right or i dont know ive been looking on youtube for a long time and i cant find any. i have looked on script helpers (this site) but none of them work or im just not setting them up. . . help

0
i needed the question mark in the title if you were wondering Spiyder1 81 — 4y
0
When you turn a statement/demand into a "question" by adding a question mark, lol Psudar 882 — 4y

Closed as Not Constructive by Psudar and BlueTaslem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
Mawfix 15
4 years ago
Edited 4 years ago

To answer Your question, here is what I've Made For you /Note: If You Are Planning To Make A Game, You Do Not Need to Credit Me

First Put This Script In ServerScriptService:





local DataStore = game:GetService("DataStoreService") local CoinsData = DataStore:GetDataStore("CoinsData") game.Players.PlayerAdded:Connect(function(plr) local stats = Instance.new("BoolValue",plr) stats.Name = "leaderstats" local coins = Instance.new("IntValue",stats) coins.Name = "Coins" coins.Value = 0 local data local success, errormessage = pcall(function() data = CoinsData:GetAsync(plr.UserId.."-Coins") end) if success then coins.Value = data else print("There Was An Error While Getting A Players Data") warn(errormessage) end end) game.Players.PlayerRemoving:Connect(function(plr) local success, errormessage = pcall(function() CoinsData:SetAsync(plr.UserId.."-Coins",plr.leaderstats.Coins.Value) end) if success then print("Player Data Was Saved") else print("There Was A Error When Saving Players Data") warn(errormessage) end end)

/Note: This Will Save A Players Data As Well As Keep It.

Next, Put This Script Inside The Vehicle Seat

toggle = false

while true do wait()
    if script.Parent.Occupant ~= nil and toggle == false then
        toggle = true
        local playerHum = script.Parent.Occupant
        local playerName = playerHum.Parent.Name
        local Player = game.Players:WaitForChild(playerName)

        local leaderStats = Player:WaitForChild("leaderstats") -- Grabs Leaderstats
        local coins = leaderStats:WaitForChild("Coins") -- Grabs Coins

        wait(3) -- Time You Want To Wait Before Cash Reward

        coins.Value = coins.Value + 100 -- Cash You Want To Reward
        toggle = false -- Turns Toggle To False
    end
end

/Note: If You Are Changing The Currency Name You Must Change It In Both Scripts

If This Has Helped You Please Accept It as an Answer.

I hope I Helped You

1
Spoon feeding at its finest. Psudar 882 — 4y
Ad