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

How to adjust quest awarding?

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

✓ Accepted answer

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!

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