I dont really know how to reference a player in a bindable event and I need help! Thank you for your time
local repStorage = game:GetService("ReplicatedStorage")
local Banana = game.Workspace.Banana
local bananaPrompt = Banana.BananaPrompt
local bananaPurchased = repStorage.BananaPurchased
bananaPurchased.Event:Connect(function(player)
local gold = player.leaderstats.Gold
if gold.Value >= 10 then
gold.Value = gold.Value - 10
Banana:Clone().Parent = player.Backpack
end
end)
Just reference the player at the beginning of the script
local player = game.Players.LocalPlayer
local repStorage = game:GetService("ReplicatedStorage")
local Banana = game.Workspace.Banana
local bananaPrompt = Banana.BananaPrompt
local bananaPurchased = repStorage.BananaPurchased
bananaPurchased.Event:Connect(function()
local gold = player.leaderstats.Gold
if gold.Value >= 10 then
gold.Value = gold.Value - 10
Banana:Clone().Parent = player.Backpack
end
end)