for _,v in CS:GetTagged("CrystalSpawner") do
local Crystal = v:FindFirstChild("Crystal")
spawnCrystal(Crystal)
--local debounce = false
Crystal.Touched:Connect(function(part)
print("a")
local score = 1
if part.Parent:FindFirstChild("Humanoid") then -- and not debounce then
--debounce = true
Crystal.Transparency = 1
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
if Crystal.BrickColor == BrickColor.new("Pink") then
score = 1
elseif Crystal.BrickColor == BrickColor.new("Electric blue") then
score = 2
elseif Crystal.BrickColor == BrickColor.new("Sea green") then
score = 3
end
plr:WaitForChild("ScoreFile").backpackValue.Value = plr.ScoreFile.backpackValue.Value + score
--wait()
--debounce = false
end
wait(crystalModule.CrystalSpawnCooldown)
Crystal.Transparency = 0
spawnCrystal(Crystal)
end)
end
When i touch the part, everything inside the function didn’t get activate, how should i fix it?