Tool Purchase Pad's Player Touch Detection not working at all

  1. What do you want to achieve? Keep it simple and clear!

I wanted to make functioning pad in 2009 Freeze Tag game that gives you tool if you have enough money by touch.

  1. What is the issue? Include screenshots / videos if possible!

Well, apparently the detection for onTouched event won’t even work at all, it’s not detecting any event or player contact, 3. What’s solutions I tried so far? I tested printing but it didn’t show up. I tried everything I can do, changing onTouched to getPlayer but it didn’t do anything, either. I also tried to put script inside pad instead of outside, just inside model but it’s up to no avail of luck.

Here’s script:

Door = script.Parent 
local debounce = false 

function getPlayer(humanoid) 
local players = game.Players:children() 
for i = 1, #players do 
if players[i].Character.Humanoid == humanoid then return players[i] end 
end 
return nil 
end 
function onTouched(hit) 
if debounce == false then 
local human = hit.Parent:findFirstChild("Humanoid") 
if (human == nil) then return end 
local player = getPlayer(human) 
debounce = true 
if (player == nil) then return end 
local stats = player:findFirstChild("leaderstats") 
local sp = stats:findFirstChild("Tags") 
if sp == nil then return false end 
if (sp.Value >= 15) then --Amount of suggested price
sp.Value = sp.Value - 15 --Same amount should go here.
print("Enough Money") 
game.Lighting.CampingJuice:clone().Parent = player.Backpack --Copying tools from Lighting for successful purchasement.
Door.BrickColor = BrickColor.new(21)
wait(2) 
Door.BrickColor = BrickColor.new(37)
debounce = false 
else debounce = false 
end 
end 

end 

connection = Door.Touched:connect(onTouched)

image

Try to put the script in server script instead of local script. I had a similar problem and this solved it.

Sadly, it’s already server script, I also tried to put in local script but it didn’t work, same thing as server script.