i have some code that when you use the proximityprompt the chest it makes sound and particles come out of it as well as some coins (kionin)
that part is right here
for i, v in pairs(Chest.Parent.Coins:GetChildren()) do
v.Transparency = 0
v.Coin.Transparency = 0
v.Touched:Connect(function(hit)
if hit.Parent:WaitForChild("HumanoidRootPart") then
if Db == false then
Db = true
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
pcall(function(err)
if Player.Name == p.Name then
SoundCoin:Play()
Player.leaderstats.Kionin.Value += 2
v:Destroy()
print(err)
wait(0.2)
Db = false
end
end)
end
end
end)
then the proximity prompt script
ProximityPrompt.Triggered:Connect(function(player)
ChestFunction(player)
while wait(1) do
print(player.Name)
end
end)
can anyone help me figure out what it is
