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

How to adjust quest awarding?

Asked by 6 years ago

I made a gui leaderstats and also made a quest system though the quest system isn't adjusting to that specific gui system so once a quest is completed, the leaderstats gui isn't affected.

Quest Completion Award:

script.Parent.Touched:connect(function(touchedpart)
    local player = game.Players:GetPlayerFromCharacter(touchedpart.Parent)
    if player then
        if player.Quest6.Value == "-[Get a Water Tank]" then
            player.Quest6.Value = "-[Completed]"
            **player.leaderstats.Neutros.Value = player.leaderstats.Neutros.Value + 400**
        end
    end

end)

GUI Leaderstats:

fol = Instance.new("Folder", game.Workspace)
fol.Name = "Data"
game.Players.PlayerAdded:connect(function(plr)
plrfol = Instance.new("Folder", fol)
plrfol.Name = plr.Name
val = Instance.new("NumberValue", plrfol)
val.Value = 0
val.Name = "Socks"
end)

game.Players.PlayerRemoving:connect(function(plr)
fol[plr.Name]:Destroy()
end)


Thanks

1 answer

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Hello, blingmcqeen!

Working scripts:

script.Parent.Touched:connect(function(touchedpart)
    local player = game.Players:GetPlayerFromCharacter(touchedpart.Parent)
    if player then
        if player:FindFirstChild("Quest6") and player:FindFirstChild("Quest6").Value == "-[Get a Water Tank]" then
            player.Quest6.Value = "-[Completed]"
            game.Workspace.Data[player.Name].Socks.Value = game.Workspace.Data[player.Name].Socks.Value + 400
        end
    end

end)
fol = Instance.new("Folder", game.Workspace)
fol.Name = "Data"
game.Players.PlayerAdded:connect(function(plr)
    local plrfol = Instance.new("Folder", fol)
    plrfol.Name = plr.Name
    local val = Instance.new("NumberValue", plrfol)
    val.Value = 0
    val.Name = "Socks"
end)

game.Players.PlayerRemoving:connect(function(plr)
    fol[plr.Name]:Destroy()
end)

Good Luck with your games!

Ad

Answer this question