hello!
i am trying to make a system that puts a bat in the players inventory i have managed to get all of that working but the bat doesn’t go in here is the code:
local ProxService = game:GetService("ProximityPromptService")
function ItemCheck(player)
print("The event has been fired")
if player.leaderstats.Cash.Value >= 1 then
print("The player has the desired Cash")
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 1
print("Cloning the item to the player's backpack")
local newitem = game.Lighting.Bat:Clone()
newitem.Parent = player.Backpack
end
end
script.Parent.Triggered:Connect(ItemCheck)
I won’t suggest you to store the Bat in Lighting instead store it in the ServerStorage. After doing that try this script.
local ProxService = game:GetService("ProximityPromptService")
function ItemCheck(player)
print("The event has been fired")
if player.leaderstats.Cash.Value >= 1 then
print("The player has the desired Cash")
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value - 1
print("Cloning the item to the player's backpack")
local newitem = game:GetService("ServerStorage").Bat:Clone()
newitem.Parent = player.Backpack
end
end
script.Parent.Triggered:Connect(ItemCheck)
Also I wanted to ask. Is the parent of the script the Proximity Prompt?