So this code should give somebody 25 "Points" upon touching and in order to prevent them using the block again will create a StringValue with the name of the their Character so in the future if the code sees there's a StringValue with their name it will not continue the code and not give them the points although it doesn't work.
Any help would be appreciated, thanks!
game.Workspace.Yellow.Touched:connect(function(otherPart) if(otherPart:FindFirstChild("Humanoid")~=nil)then if(game.Workspace.Yellow:FindFirstChild(otherPart)==nil)then newInstance=game.Workspace.Instance.new("StringValue") newInstance.Name=(otherPart) local user = game.Players:GetPlayerFromCharacter(otherPart.Parent) local stats = user:findFirstChild("leaderstats") if stats ~= nil then local points = stats:findFirstChild("Points") points.Value = points.Value +25 wait(25) end end end end)
Here put this in the block
script.Parent.Touched:connect(function(hit) if game.Players:GetPlayerFromCharacter(hit.Parent) then player = game.Players:GetPlayerFromCharacter(hit.Parent) player:FindFirstChild("leaderstats").Points.Value = player:FindFirstChild("leaderstats").Points.Value + 1 end end)