In this Roblox Studio Tutorial, I will show you guys how to make a coin where you can Press the Letter E and hold it to collect the coin.
This version only works in SinglePlayer!
This video will also touch on the basics of inserting a shape, proximity prompts and how to use remote events! It is also very easy to follow with the smooth editing and relaxing background music!
How to make it Randomized + Gui that pops up to tell you how much cash you earned from the coin:
• Roblox How To | Making the Coin Rando...
SCRIPTS:
Leaderstats Script:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Cash = Instance.new("IntValue")
Cash.Name = "Cash" --Make sure the Cash in the quotation marks matches with the one in the AddCoin script
Cash.Value = 0 --Set the 0 to how much cash you want the player to start off with
Cash.Parent = leaderstats
end)
Proximity Prompt Script:
--//variables
local trigger = script.Parent
local RemoteEvent = game.ReplicatedStorage:WaitForChild("CollectCoin")
--Make sure that ColloectCoin matches with the remote event inside the replicated storage
trigger.Triggered:Connect(function(player)
RemoteEvent:FireClient(player)
trigger.Parent:Destroy() --delete this if you want the coin to stay on the map
end)
StarterGui Localscript:
--//variables
local remoteEvent = game.ReplicatedStorage:WaitForChild("CollectCoin")
--Make sure that ColloectCoin matches with the remote event inside the replicated storage
local player = game.Players.LocalPlayer
local cash = player.leaderstats.Cash --Make sure the Cash at the end matches with the one in the leaderstats
remoteEvent.OnClientEvent:Connect(function()
cash.Value += 5 --change the 5 to how much cash you want the player to recieve
end)
My Discord server: / discord
Make sure to like and subscribe if you enjoyed it or if this video helped :)
Music License: https://www.bensound.com/
Music License 2: https://creativecommons.org/licenses/...
Music used: (In order:)
Andy Griffith Theme - Andy Griffith Tribute HipHop Beat (Instrumental)
• Andy Griffith Theme - Andy Griffith T...
Kevin MacLeod [Official] - The Show Must Be Go! - incompetech.com
• Kevin MacLeod [Official] - The Show M...
Tobu - Candyland [NCS Release]
• Video
Tags: #Roblox, #Robloxstudio, #Howto, #onfirerobloxscripting, #tutorial, #Robloxtutorial