Hello all, I am creating a questing system, and the GUI Will NOT load after line 87-89 happens and I have no clue as to why! I will post the whole script here, to see if it's an issue with anything else. Everything is in the correct places according to the code, and everything lines up properly, so as to why it doesn't work is beyond me! Any and all help is appreciated! Thanks Code:
repeat wait() until game.Players.LocalPlayer --Rewards------------------------------------------------------------------------------------------ local Gold = true --True/False local GoldReward = 50 --Number local Experience = false --True/False local ExperienceReward = 100 --Number local Weapon = " " --Weapon Name local BadgeID = 0 --Badge ID ------------------------------------------------------------------------------------------------------- function Reward(plyr) if Gold then plyr.leaderstats.Gold.Value = plyr.leaderstats.Gold.Value + GoldReward end if Experience then plyr.leaderstats.XP.Value = plyr.leaderstats.XP.Value + ExperienceReward end if Weapon ~= " " then game.ReplicatedStorage[Weapon]:clone().Parent = plyr.Backpack game.ReplicatedStorage[Weapon]:clone().Parent = plyr.StarterGear end game:GetService("BadgeService"):AwardBadge(plyr.userId, BadgeID) end --Settings--------------------------------------------------------------------------------------------- QuestName = "Quest1" --Name of QuestGui local Monster = "InfectedSoldier" local Kills = 10 ------------------------------------------------------------------------------------------------------- local a = 1 local TextFrame = script.Parent:WaitForChild("Talk") local Dialog = script.Parent:WaitForChild("TextButton") local Dialog2 = script.Parent:WaitForChild("TextButton2") local Player = game.Players.LocalPlayer ------------------------------------------------------------------------------------------------------- script.Parent.TextButton.MouseButton1Click:connect(function() if not Player:FindFirstChild(Monster) then if a == 1 then a = 2 TextFrame.Text = "Hey! Can you help me?" --NPC Dialog.Text = "What do you need help with?" -- You elseif a == 2 then a = 3 TextFrame.Text = "Those terrible Military Soldiers killed my family. Slay them..." --NPC Dialog.Text = "For sure!" -- You Dialog2.Text = "No. I'm not ready" elseif a == 3 then a = 4 TextFrame.Text = "Thank you, avenge them! I will give you 50 Gold!" --NPC Dialog.Text = "Awesome! I will!" -- You Dialog2:Destroy() elseif a == 4 then local c = Instance.new("IntValue", Player) c.Name = Monster c.Value = 0 local z = game.ServerStorage.Quest1:clone() z.Parent = Player:FindFirstChild("PlayerGui") script.Parent.Parent:Destroy() end elseif Player:FindFirstChild(Monster) then if Player[Monster].Value < Kills then if a == 1 then a =2 TextFrame.Text = "You need to kill more!" --What happens if you didn't kill enough Dialog.Text = "Ok!" Dialog2:Destroy() elseif a == 2 then script.Parent.Parent:Destroy() end elseif Player[Monster].Value >= Kills then if a == 1 then a = 2 TextFrame.Text = "Thank you! Here is your Gold!!" --When you finish the quest Dialog.Text = "You're welcome! They will rest well." Dialog2:Destroy() if Player.PlayerGui:FindFirstChild(QuestName) then Player.PlayerGui[QuestName]:Destroy() end elseif a == 2 then Player[Monster]:Destroy() script.Parent.Parent:Destroy() Reward(Player) end end end end) script.Parent.TextButton2.MouseButton1Click:connect(function() script.Parent.Parent:destroy() end)
I think the problem lies here:
repeat wait() until game.Players.LocalPlayer
This should be:
repeat wait() --Code until game.Players.LocalPlayer
Refer to https://developer.roblox.com/articles/Roblox-Coding-Basics-Loops#repeat