#PlayerGui is missing
18 messages · Page 1 of 1 (latest)
Is this while loading in?
Probably a race condition, your code getting loaded before the playergui is loaded.
playergui doesnt load at all
i tried searching for it
like
after a while
its just weird..
im just confused
i didnt know that you could prevent PlayerGui from loading in
and I dont know whats causing it
I found out what script is causing it
debug.setmemorycategory("CreditsHandler")
local SSS = game:GetService("ServerScriptService")
local WHM = require(SSS["Hayper's Scripts"].WebhookHandler)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local Modules = ReplicatedStorage:WaitForChild("Modules")
local DataStore2 = require(Modules.DataStore2)
DataStore2.Combine("DATA", "Credits")
local function handleExtraPay(player: Player)
if not player then return 10 end
local char: Model? = player.Character
if not char then return 10 end
local humanoid: Humanoid? = char:FindFirstChildOfClass("Humanoid")
if not humanoid then return 10 end
local objValue: ObjectValue? = humanoid:FindFirstChild("ExtraPay")
if not objValue then return 10 end
local mainModel: Model? = objValue.Value
if not mainModel then objValue:Destroy() return 10 end
local gainAmount: number? = mainModel:GetAttribute("AdditionalCredits")
if not gainAmount then objValue:Destroy() return 10 end
local gainZone: Part? = mainModel:FindFirstChild("Zone")
if not gainZone then objValue:Destroy() return 10 end
local params = OverlapParams.new()
params.FilterType = Enum.RaycastFilterType.Include
params.FilterDescendantsInstances = {char}
local everything = workspace:GetPartsInPart(gainZone, params)
for _,part in everything do
if not part.Parent then continue end
if Players:GetPlayerFromCharacter(part.Parent) == player then
return 10+gainAmount
end
end
objValue:Destroy()
return 10
end
local changedSignals = {}
Players.PlayerAdded:Connect(function(player: Player)
local CreditDatastore = DataStore2("Credits", player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local CreditValue = Instance.new("IntValue")
CreditValue.Name = "Cash" -- Why
CreditValue.Value += CreditDatastore:Get(0)
CreditValue.Parent = leaderstats
leaderstats.Parent = player
local function updateCredit(data)
ReplicatedStorage:WaitForChild("Remotes").UpdateCredits:FireClient(player, data)
end
local oldCredits = CreditValue.Value
changedSignals[player] = CreditValue:GetPropertyChangedSignal("Value"):Connect(function()
local newCredits = CreditValue.Value
local CreditDifference = newCredits-oldCredits
if CreditDifference > 10 then
WHM.queueMessage(player.Name .. "/" .. player.UserId .. " has gained '" .. CreditDifference .. "' Credits, Old: " .. oldCredits .. " / New: " .. newCredits .. "", "Credit")
end
CreditDatastore:Set(CreditValue.Value)
oldCredits = newCredits
end)
updateCredit(CreditValue.Value) -- Not sure why this was a table anyway
CreditDatastore:OnUpdate(updateCredit)
task.spawn(function() -- Passive Income
while task.wait(40) do
if player.Parent == nil then break end -- Player left, We quit
CreditValue.Value += handleExtraPay(player) -- Normally returns 10 unless specified otherwise
end
end)
if game.PrivateServerId == "" then
task.spawn(function() -- Autosave
while task.wait(60) do
if player.Parent == nil then break end -- Player left, We quit
CreditDatastore:Save()
end
end)
end
end)
Players.PlayerRemoving:Connect(function(player: Player)
if changedSignals[player] then
changedSignals[player]:Disconnect()
changedSignals[player] = nil
end
end)
@grand daggerany idea whats wrong with this?