If I want a player to get a reward after completing something and I only want that to happen once. I mean even if he completes it one more time he won't get the reward. Explain and tell the script.
Hello! I will give you an abstract Idea to how to do it, I am going to make a touch function that will only work once:
local debounce = true script.Parent.Touched:Connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) and debounce then debounce = false wait(1) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) print("Hit by plr named "..plr.Name) end end)
As you can see, I used the debounce variable, which lets you only step on the brick once. Hope it helps! Please accept if helps.
I think I understand your question. Here is an example below:
local canReward = 1 --You'd start this at 1 for reasons later. function reward() if canReward == 1 then --Run the rewarding script in here canReward = 0 --Set canReward to 0 so the function cannot reward again end if canReward == 0 then print("Player has already been rewarded!") end end --Basically what this script does is it has an overall reward variable. If that variable is 1, then the player gets rewarded and the variable gets set to 0, which means that it cannot reward the next time the player does the task.
Hope this helped, and happy scripting!