Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Help with Point Giving System?

Asked by 10 years ago

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!

01game.Workspace.Yellow.Touched:connect(function(otherPart)
02    if(otherPart:FindFirstChild("Humanoid")~=nil)then
03        if(game.Workspace.Yellow:FindFirstChild(otherPart)==nil)then
04            newInstance=game.Workspace.Instance.new("StringValue")
05            newInstance.Name=(otherPart)
06            local user = game.Players:GetPlayerFromCharacter(otherPart.Parent)
07            local stats = user:findFirstChild("leaderstats")
08        if stats ~= nil then
09            local points = stats:findFirstChild("Points")
10            points.Value = points.Value +25
11            wait(25)
12        end
13        end
14    end
15end)

1 answer

Log in to vote
0
Answered by 10 years ago

Here put this in the block

1script.Parent.Touched:connect(function(hit)
2    if game.Players:GetPlayerFromCharacter(hit.Parent) then
3        player = game.Players:GetPlayerFromCharacter(hit.Parent)
4        player:FindFirstChild("leaderstats").Points.Value = player:FindFirstChild("leaderstats").Points.Value + 1
5    end
6end)
0
Change 1 to how much you want it to award fireboltofdeath 635 — 10y
Ad

Answer this question