Scripts That Work In Studio Aren't Working In Game

I’ve recently experienced scripts that are working fine in Roblox Studio not working in the actual game. This started happening on January 21st, 2021 and still occurs.

For example this inventory and egg hatching system:

Studio

https://gyazo.com/ec8e71137974fb07a222d8b74c00b855

Game

https://gyazo.com/0c5668b16d8c9a7ab25a21db536f986e

As you can see in the game nothing is showing up in the inventory. Another example is my egg hatching system shown below.

Studio

https://gyazo.com/e716ec1957a3b4d976041a11b23e9936

And in the game you can’t even start hatching the egg because the inventory UI won’t appear. The egg hatching system’s data is saved using regular DataStores, so if I join in studio the egg will appear.

Studio

https://gyazo.com/fbdfb52c342ef2d2caf2af06f20f1142

Now after I just joined studio I joined the actual game and this is what showed up

https://gyazo.com/b23d7f92017a7acef072443cba8d8e30

Nothing shows up, however the data does get loaded in successfully, as other scripts that use the same data work fine.

Earlier today when I joined the game the scripts surprisingly worked for once, so I left, joined again immediately after, and it was back to the usual unworking scripts.

I’ve tried overwriting an empty baseplate and publishing it as a new game, but got the same results.

I contacted Roblox Support yesterday to report this issue and I got this as the answer:

We understand that sometimes you may run into problems building and scripting to which you just can’t figure out a solution. With all of the power available through Roblox and Roblox Studio, you may even have difficulty knowing where to start. Luckily, we have several sources of information that might be able to help. Please check out the Building and Scripting Help and Tutorials help article for information on these sources.

Extremely useless, as none of the information in the link seem to help with my issue. No bugs or errors are shown in the output in Roblox Studio, so to me this seems like an issue that is out of my control.

Looks to be a loading glitch with your UIs. I’d check to make sure they’re going to the correct part in the frame. If that’s all well and done, It should’ve worked. Otherwise what Zach said, there’s probably some malware in your game

How would I take the malware out if I have any? I also never imported any free models and all assets used in the game were only touched by me.

For example this simple remote event that fires to the client.

`ShowPet:FireClient(plr, pet[1])--fire the player so the pet shows up in their inventory`

2 different scripts receive the remote event and do the same exact thing when they receive it.  Except in game only the first script works.  They're in the right frames and everything, otherwise I'd be getting an error in studio,

local player = game.Players.LocalPlayer

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ShowPet = ReplicatedStorage:WaitForChild("PurchasePrompts").ShowPet

local scrollingFrame = script.Parent

local canvas = script.Parent
local contraint = script.Parent:WaitForChild("UIGridLayout")

local function UpdateCanvasSize(Canvas, Constraint)--RESET THE CANVAS SIZE
	Canvas.CanvasSize = UDim2.new(0, Constraint.AbsoluteContentSize.X, 0, Constraint.AbsoluteContentSize.Y)
end

local function addTemplate(pet)
	local newTemplate = script.PetTemplates:FindFirstChild(pet):Clone()
	newTemplate.Name = pet
	newTemplate.Parent = scrollingFrame

	

	UpdateCanvasSize(canvas, contraint)
end

ShowPet.OnClientEvent:Connect(addTemplate)











local player = game.Players.LocalPlayer

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ShowPet = ReplicatedStorage:WaitForChild("PurchasePrompts").ShowPet


local scrollingFrame = script.Parent

local canvas = script.Parent
local contraint = script.Parent:WaitForChild("UIGridLayout")

local function UpdateCanvasSize(Canvas, Constraint)--RESET THE CANVAS SIZE
	Canvas.CanvasSize = UDim2.new(0, Constraint.AbsoluteContentSize.X, 0, Constraint.AbsoluteContentSize.Y)
end

local function addTemplate(pet)--Add the new template
	local newTemplate = script.PetTemplates:FindFirstChild(pet):Clone()
	newTemplate.Name = pet
	newTemplate.Parent = scrollingFrame

	

	UpdateCanvasSize(canvas, contraint)
end

ShowPet.OnClientEvent:Connect(addTemplate)

This simple animation script that animates an object in studio doesn’t work in game. Yes the animation is published to Roblox

local animation = Instance.new("Animation")

animation.AnimationId = "https://www.roblox.com/asset/?id=6243308493"

local AnimationController = script.Parent:FindFirstChild("AnimationController")

local animationTrack = AnimationController:LoadAnimation(animation)

animationTrack.Looped = true

animationTrack:Play()

I found a hacky way around this, however it makes my scripts much more complicated. At least it works.

1 Like