It’s fine now I found the problem, thanks for trying to help!
What do you want to achieve? Keep it simple and clear!
Stop coins breaking after resetting.
What is the issue? Include screenshots / videos if possible!
I can collect coins perfectly fine until resetting. There are no errors in the output.
Discovered resetting stops this from working.
humanoid.Touched:connect(function(hit)
if hit.Name == “Coin” or hit.Name == “roofCoin” or hit.Name == “slapperCoin” or hit.Name == “parkCoin” or hit.Name == “swimingCoin” or hit.Name == “slideCoin” or hit.Name == “obbyCoin” then
local db = hit:FindFirstChild("collect")
if db.Value == true then
db.Value = false
hit.Transparency = 1
script.Sound:Play()
wait(1)
hit:Remove()
local playersss = game:GetService("Players").LocalPlayer
local charactor = playersss.Character or playersss.CharacterAdded:Wait()
local humanoid = charactor:WaitForChild("Humanoid")
humanoid.Touched:connect(function(hit)
if hit.Name == "Coin" or hit.Name == "roofCoin" or hit.Name == "slapperCoin" or hit.Name == "parkCoin" or hit.Name == "swimingCoin" or hit.Name == "slideCoin" or hit.Name == "obbyCoin" then
local db = hit:FindFirstChild("collect")
if db.Value == true then
print("Debounce FOUND")
db.Value = false
print("Debounce falsified")
hit.Transparency = 1
script.Sound:Play()
wait(1)
print("Coin is being removed")
hit:Remove()
print("Coin is REMOVED")
Nothing was printed when it broke.
Confirmed resetting will stop this script working.
I think I see the problem here. The code doesn’t have a end under it so it’s not able to work. Check any errors in the script analysis.
It should look like this
local playersss = game:GetService("Players").LocalPlayer
local charactor = playersss.Character or playersss.CharacterAdded:Wait()
local humanoid = charactor:WaitForChild("Humanoid")
humanoid.Touched:connect(function(hit)
if hit.Name == "Coin" or hit.Name == "roofCoin" or hit.Name == "slapperCoin" or hit.Name == "parkCoin" or hit.Name == "swimingCoin" or hit.Name == "slideCoin" or hit.Name == "obbyCoin" then
local db = hit:FindFirstChild("collect")
if db.Value == true then
print("Debounce FOUND")
db.Value = false
print("Debounce falsified")
hit.Transparency = 1
script.Sound:Play()
wait(1)
print("Coin is being removed")
hit:Remove()
print("Coin is REMOVED")
end
end
end)
if hit.Name == "Coin" or hit.Name == "roofCoin" or hit.Name == "slapperCoin" or hit.Name == "parkCoin" or hit.Name == "swimingCoin" or hit.Name == "slideCoin" or hit.Name == "obbyCoin" then
The hit argument is attempting to find the Names that are inside those parts (If I recall correctly), you can use (As Brainy stated) hit.Parent to find the Character easily. if you’re trying to find the CoinNames inside the Character, just hit alone will only attempt to find the hit.Name inside that specific part “Left Leg” “Right Arm”, etc (You could also print out the hit variable to see what’s being touched)