Hey scriptinghelpers, I'm on working on a on touch script that awards leaderstats then teleports the player. The problem I'm having is with my debounce. I tried putting it in a few different places to have no luck. It awards currency for every hit which is R15. Below you will find my code.
Edit: This is a Script inside of a Part also this is the fixed version and what I did, when hit find HumanoidRootPart
local function onTouch(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then local player = game.Players:FindFirstChild(hit.Parent.Name) if player and hit.Name == "HumanoidRootPart" then if player.MembershipType == Enum.MembershipType.Premium then player.leaderstats.Tix.Value = player.leaderstats.Tix.Value + 2 hit.Parent:Move(game.Workspace.LO.Position) else player.leaderstats.Tix.Value = player.leaderstats.Tix.Value + 1 hit.Parent:MoveTo(game.Workspace.LO.Position) end end end end script.Parent.Touched:Connect(onTouch)