Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with Point Giving System?

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)

1 answer

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)

1 comment

0

Change 1 to how much you want it to award

This discussion is preserved as it was. New answers, comments, and votes are closed.