I am trying to make a game but you need to complete quests to unlock the swords. When you complete a quest it will update a BoolValue and make the button to use the sword visible. You start off with the Starter Sword and the Holy Lightning Blade if you have the VIP gamepass. It is working fine in studio but it won't work in game.
View in studio
View in game
Script that creates the values and stores them once the player leaves:
local datastoreservice = game:GetService("DataStoreService") local odata = datastoreservice:GetDataStore("show") local Market = game:GetService("MarketplaceService") game.Players.PlayerAdded:Connect(function(plr) local show = Instance.new("Folder", plr) show.Name = "show" local HLB = Instance.new("BoolValue", show) HLB.Name = "HLB" local MB = Instance.new("BoolValue", show) MB.Name = "MB" local NS = Instance.new("BoolValue", show) NS.Name = "NS" local SB = Instance.new("BoolValue", show) SB.Name = "SB" local SS = Instance.new("BoolValue", show) SS.Name = "SS" local STS = Instance.new("BoolValue", show) STS.Name = "STS" local WS = Instance.new("BoolValue", show) WS.Name = "WS" local dMB local dNS local dSB local dSS local dSTS local dWS pcall(function() dMB = odata:GetAsync(plr.UserId.."-dMB") dNS = odata:GetAsync(plr.UserId.."-dNS") dSB = odata:GetAsync(plr.UserId.."-dSB") dSS = odata:GetAsync(plr.UserId.."-dSS") dSTS = odata:GetAsync(plr.UserId.."-dSTS") dWS = odata:GetAsync(plr.UserId.."-dWS") end) if dMB ~= nil then if Market:UserOwnsGamePassAsync(plr.UserId, 7483219) then HLB.Value = true else HLB.Value = false end MB.Value = dMB NS.Value = dNS SB.Value = dSB SS.Value = dSS STS.Value = dSTS WS.Value = dWS else if Market:UserOwnsGamePassAsync(plr.UserId, 7483219) then HLB.Value = true else HLB.Value = false end MB.Value = false NS.Value = false SB.Value = false SS.Value = false STS.Value = true WS.Value = false end end) game.Players.PlayerRemoving:Connect(function(plr) local show = plr:FindFirstChild("show") local MB = show.MB local NS = show.NS local SB = show.SB local SS = show.SS local STS = show.STS local WS = show.WS pcall(function() odata:SetAsync(plr.UserId.."-dMB", MB.Value) odata:SetAsync(plr.UserId.."-dNS", NS.Value) odata:SetAsync(plr.UserId.."-dSB", SB.Value) odata:SetAsync(plr.UserId.."-dSS", SS.Value) odata:SetAsync(plr.UserId.."-dSTS", STS.Value) odata:SetAsync(plr.UserId.."-dWS", WS.Value) end) end)
For example: the script that makes the Holy Lightning Blade visible (its parent is the button):
local show = game.Players.LocalPlayer:WaitForChild("show") local sHLB = show:WaitForChild("HLB") sHLB.Changed:Connect(function() if sHLB.Value == true then script.Parent.Visible = true end end)
So any ideas?