I need a way to be able to when you press "e" it will make a Model disappear and give you 15 coins? My coins are called "Coins"
✓ ANSWER ACCEPTED
I need a way to be able to when you press "e" it will make a Model disappear and give you 15 coins?
2 answers
✓ Accepted answer
Put a LocalScript into the StarterGui ::
wait()
local UIS = game:GetService("UserInputService")
local leaderstats = game.Players.LocalPlayer:WaitForChild("leaderstats")
local coins = leaderstats.Coins
----- Optional: Change this ------
local key = "E"
local reward = 15
------ Change this -------
local model = workspace.Model
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode[key] then
coins.Value = coins.Value + reward
model:Destroy()
end
end)
Right Here Is What I Concluded:
local Plr = game.Players.LocalPlayer
local model = workspace.Test -- The Model To Hide
local amountofcoins = 15 -- How Many Coins Earned
Plr:GetMouse().KeyDown:Connect(function(Key)
if Key == "e" then
model:Destroy()
Plr.leaderstats.Coins.Value = Plr.leaderstats.Coins.Value +1
end
end)
Make Sure The Script Is Local!
If You Still Need Help DM Me: Harry_TheKing1#2303
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
This is a help site NOT a request site!