So I am working on a sword fight for Player Points game and I do not want a map in it. Here let me explain to you. I want it to give you a sword when you step on a certain brick. Like I have a plate where they are supposed to fight but I cant get it to give just one sword. It gives swords every time they move I am trying to make it to where it only gives one and I don't know how I would make it work for game passes. Like when you have this game pass you get a Illumina not a regular sword.
Script that I have inside the Plate and the Weapon:
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 onTouch(part) local human = part.Parent:findFirstChild("Humanoid") if (human ~= nil) and debounce == false then debounce = true local player = getPlayer(human) if (player == nil) then return end script.Parent:clone().Parent = player.Backpack wait(2) debounce = false end end script.Parent.Parent.Touched:connect(onTouch)
I have the sword put inside the brick and everything works but it constantly gives you more not one and it doesn't add a different kind of sword if they have the game pass D: Help please if you can!