Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why models can't detect touch with this script?

Put this inside of a model but nothing happens. Please help, thank you! <3

local debounce = false

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if debounce == false then
			debounce = true
			player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 1
			wait(1)
			debounce = false
		end
	end
end)

1 comment

0

I think Its that OnTouched Can Only Work On Parts and Not Models So I think you are going to Have to select a Part and put the script in That

1 answer

Models don't detect touches. If this is some sort of NPC the player is supposed to be touching, put the script in their Head or HRP, some sort of part in the NPC you would be able to hit.

This discussion is preserved as it was. New answers, comments, and votes are closed.