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!

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

Log in to vote
0
Answered by 10 years ago

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)
0
Change 1 to how much you want it to award fireboltofdeath 635 — 10y
Ad

Answer this question