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

Long script not running before it got splitted?

Asked by 3 years ago

So i have this line of script:

local player = script.Parent.Parent.Parent.Parent

local playerinfo = player:WaitForChild("Info")
local playerleaderstats = player:WaitForChild("leaderstats")

local playerquest = playerinfo:WaitForChild("Quest")
local playerquestcompleted = playerinfo:WaitForChild("QuestCompleted")

local playercoin = playerleaderstats:WaitForChild("Coin")
local playergems = playerleaderstats:WaitForChild("Gems")
local playerprogress = playerinfo:WaitForChild("QuestProgress")
local playermax = playerinfo:WaitForChild("QuestMax")

local QuestBar = script.Parent.Quest

local QuestName = QuestBar.QuestName.Text
local QuestProgress = QuestBar.Progress.Text
local Reward1 = QuestBar.Reward1.Text
local Reward2 = QuestBar.Reward2.Text



function GiveReward(Coin, Gems)
    playercoin.Value += Coin
    playergems.Value += Gems

    playerquestcompleted.Value += 1
end



function GiveQuest(QuestCompleted)
    if QuestCompleted == "MayorA" then
        playerquest = "MayorB"

    elseif QuestCompleted == "MayorB" then
        playerquest = "MayorC"

    elseif QuestCompleted == "MayorC" then
        playerquest = "MayorD"

    elseif QuestCompleted == "MayorD" then
        playerquest = "MayorE"

    elseif QuestCompleted == "MayorE" then
        playerquest = "DesertA"
    end
end



while wait(1) do
    if playerquest.Value == "" then
        playerquest.Value = "MayorA"
    end

    --Quest
    if playerquest.Value == "MayorA" then
        QuestName = "Find Cat"

        if playerprogress == 1 then
            GiveQuest("MayorA")
            GiveReward(250,10)
        end


    elseif playerquest.Value == "MayorB" then
        QuestName = "Collect 5 Toxic"


    elseif playerquest.Value == "MayorC" then
        QuestName = "Upgrade Strength to 20"


    elseif playerquest.Value == "MayorD" then
        QuestName = "Upgrade Backpack to 60"


    elseif playerquest.Value == "MayorE" then
        QuestName = "Unlock Desert Island"

    end
    --End

    QuestProgress = playerinfo:WaitForChild("QuestProgress").Value.."/"..playerinfo:WaitForChild("QuestMax").Value
end

But it wont work at all, no output. But when i split em its working!

what happened ;-;

0
what do you mean splitting? do you mean dividing the script into 2 modules? which line is it? Speedmask 661 — 3y
0
@yes The_Saver31 260 — 3y

Answer this question