Things Working in Studio but not in Game?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    There are GUIs, LocalScripts, and some Scripts that are not working in game, but are working in studio solo. I wish to fix it.

  2. What is the issue? Include enough details if possible!
    Up.

  3. What solutions have you thought of so far?
    I’ve looked for what allows LocalScripts to run and what doesn’t (their location, that is) and placed them in what seems to be the proper places - still do not work. Scripts are situated in ScriptService, where I think they should be, and only one script seems to work. Another does depend on receiving a remote call from a LocalScript to work (game is FilteringEnabled). As for GUIs, they’re in StarterGui as they should be.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

5 Likes

Have you indexed some of your parts with :WaitForChild() and :FindFirstChild()? This can cause issues like these like it has in the past. Especially for me in the past. If you have, please post your code so we know what is broken.

2 Likes

Yea, I was looking to see if that’s one of the things I did, and no, the LocalScripts in GUIs use ‘script.Parent’ when referencing the copied-to-player GUI rather than the StarterGui.

The issue is, not even the GUIs are being copied over to the player, yet alone the LocalScripts (and one in particular that does some selection work).

2 Likes

Alright, can you post the code so I can see what’s wrong?

2 Likes

There are 2 so far, thankfully I caught this right now, here’s one that just does hex selection and is not even registered.

local player = game:GetService(‘Players’).LocalPlayer
local mouse = player:GetMouse()
local userInputService = game:GetService(‘UserInputService’)
local replicatedStorage = game:GetService(‘ReplicatedStorage’)
local event = replicatedStorage.Remotes.ChangeSelected
local hex
local previousSelection = false

userInputService.InputBegan:Connect(function(input, gameProcessed)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
if mouse.Target then
if mouse.Target.Name == ‘HexTile’ or mouse.Target.Name == ‘TileIdentifier’ then
hex = mouse.Target.Parent
end
end
end

if hex then		
	if hex:FindFirstChild('TileType') and hex.TileType.Value ~= nil then
		if replicatedStorage.Nations:FindFirstChild(player.Name) and replicatedStorage.Nations:FindFirstChild(player.Name).Value == hex.HexTile.BrickColor.Name then
			if hex.TileType.Value == 'City' or hex.TileType.Value == 'Fort' or hex.TileType.Value == 'Village' then
				if player.PlayerGui.InteractGui.Enabled == false then
					player.PlayerGui.InteractGui.Frame.HexTileName.Text = hex.Name
					player.PlayerGui.InteractGui.SelectedHex.Value = hex.Name
					event:FireServer(player.PlayerGui.InteractGui.SelectedHex.Value)
					player.PlayerGui.InteractGui.Enabled = true
				else
					player.PlayerGui.InteractGui.Enabled = false
				end
			end
		end
	
		if not player.PlayerGui:FindFirstChild('SelectionBox') then
			local selected = Instance.new('SelectionBox', player.PlayerGui)
			selected.Adornee = hex.HexTile
			selected.LineThickness = 0.1
		elseif player.PlayerGui:FindFirstChild('SelectionBox') then
			player.PlayerGui.SelectionBox:Destroy()
		end
	end
end
hex = nil

end)

1 Like

err, I don’t know how to put that script properly lol, my bad.

2 Likes

Did you commit the scripts?
Do so by going into view tab and pressing “Commit” or something similar and a new window will pop up and then select your script and press commit

2 Likes

I did not. Didn’t know that was a thing. Let me try right now.

But why aren’t GUIs being copied over? Even ones that are enabled and should appear on the screen once the player spawns.

1 Like

Well im not a scripter nor gui maker im just a modeller

1 Like

That’s odd, I don’t see the problem. Perhaps it’s your scripts?

1 Like

That one is just local and meant for the client, it does not interact with any server script whatsoever.

Edit: Beyond the remote event fire. But, I still don’t understand why it doesn’t even come to that point? The event fire doesn’t do anything at the moment either, it could be commented.

1 Like

Yeah, I’m confused too. I hope you find your solution soon because I am bewildered.

2 Likes

Thank you for trying to help though! I appreciate it.

2 Likes

Yea, I can’t find anything under the ‘view’ tab in studio that allows me to commit any scripts. Even when selecting scripts.

2 Likes

Imma try to find it rn
Hold on please

1 Like

It’s called “Drafts” on the right
right under the Terrain Editor, atleast for me

1 Like

Nope.

https://gyazo.com/921ef793f3e66f78ba8a2839cba4cb9c

1 Like

I don’t know then, not really an expert in scripting
Good luck I have to go now

2 Likes

Thank you, regardless!
30chars

1 Like

Have you published the game? If so, that is strange.

3 Likes