local settengs = script.Settings --Identified the folder containing our stats local yPoints1 = settengs.Stat01.Value local amount1 = settengs.Stat01Amount.Value local waittime = settengs.WaitTime.Value --Identified the stats local ting = 0 --Debouncer function OnTouch(Touched) (script.Parent.Touched:connect(OnTouch) if ting == 0 then ting = 1 local Touchy = Touched.Parent:FindFirstChild("Humanoid") if Touchy ~= nil then --If the toucher is a humanoid then proceed local Player = game.Players:GetPlayerFromCharacter(Touched.Parent) local stats = Player:findFirstChild("leaderstats") if stats ~= nil then local StatToIncrease = stats:findFirstChild(yPoints1) - StatToIncrease.Value = StatToIncrease.Value +amount1 wait(waittime) print(":Script executed successfully!") end end ting = 0 --remove debounce end end script.Parent.Touched:connect(OnTouch)
That gives you the point if you stand on it but i want it so when you shoot the button (With a projectile) you get the point, Not when you stand on it??
(Forgive me if I misunderstood your question. It's worded pretty badly) Add this to the top of the function:
if Touched.Name ~= "Bullet" then return end
Change "Bullet" to the name of whatever you want to trigger the button If you want more than one kind of projectile then make it if Touched.Name ~= "Bullet" or Touched.Name ~= "Bullet2" then return end
From the looks of your script, the bullet would need to be in the player's character.