Adding a bat into the players inventory

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)
1 Like

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?

yeah it is ill try out that now

right the bat when the player holds it it tps them to the spot were the bat is any idea how to fix that? @jaipack17

You must have anchored the Handle of the Tool
You must unanchor the part named Handle

yea i fixed it thanks for the help with the code :smiley: