Script not Running

I have a script in Workspace that is to run when the Local Script under the PlayerGui enables it and the Bool value that makes the script know when to run. Although the Script isn’t running, I’ve used print to check everything and everything in the Local Script seems to be working, It says that it has Enabled the Script and It’s required Bool Value but every line of code in the script doesn’t run at all not even Print?

Local Script: (The whole script isn’t included only what is part of the “Minigame Function” )

-- Initiate Minigame Function
		
print("Intermission_Has_Finished.. true")
print("Minigame_Function_Starting.. true")
		
game.Workspace.Global_Functions.Minigame_Handler.Functions.Main_Function.Disabled = false
game.Workspace.Global_Functions.Minigame_Handler.Values.Run_Minigame_Selection.Value = true
		
if game.Workspace.Global_Functions.Minigame_Handler.Functions.Main_Function.Disabled == false and game.Workspace.Global_Functions.Minigame_Handler.Values.Run_Minigame_Selection.Value == true then
			
	print("Minigame_Function_Disabled.. false")
			
end
		
	script.Check_If_Player_Is_Loading.Disabled = true
	script.Disabled = true
		
if script.Disabled == false then
			
	print("Intermission_Primary_Function_Script.. Failed to Disable..")
			
end

Script:

-- Variables

local Value_Stores = script.Parent.Parent.Values

-- Code (Run mg)

if Value_Stores.Run_Minigame_Selection.Value == true then
	
	-- Table (Selection)

	local Minigames = {'Spleef', 'Laser_Tag', 'Road_Rage', 'Guessing_Mayhem', 'Remember_Flash', 'Maze', 'Bomb_Tag', 'Takeover'} -- 

	local mg = Minigames[math.random(1, #Minigames)]
	print("Selected Minigame:" , mg .. "..")
	
	-- Prepare Minigame
	
	if mg == "Spleef" then
		
		-- Load Spleef
		
		-- Change Part Transparency
		
		for _, v in pairs(game.Workspace.Minigames.Spleef.Spleef:GetChildren()) do
			
			v.Transparency = 0

		end
		
	end
	
	if mg == "Laser_Tag" then

		-- Load Laser_Tag
		print("Current Minigame =" , mg)

	end
	
	if mg == "Road_Rage" then
		
		-- Load Road_Rage
		print("Current Minigame =" , mg)
		
	end
	
	if mg == "Guessing_Mayhem" then

		-- Load Guessing_Mayhem
		print("Current Minigame =" , mg)

	end
	
	if mg == "Remember_Flash" then

		-- Load Remember_Flash
		print("Current Minigame =" , mg)

	end
	
	if mg == "Maze" then

		-- Load Maze
		print("Current Minigame =" , mg)

	end
	
	if mg == "Bomb_Tag" then

		-- Bomb_Tag
		print("Current Minigame =" , mg)

	end
	
end

This is probably a very easy fix or a little mistake I made but I’ve been trying to fix it for a while now and I can’t figure it out at all

1 Like

Theres also no Output Errors from the Workspace Script, or any Output at all for that matter.

is there any output from the main script?

The local script works fine, there is Output from it and everything although the script from Workspace has no Output whatsoever, it doesn’t run any lines of code

how do you trigger this script?

does it only need to run once?

The script is triggered after an Intermission of 45 Seconds, it chooses and configures the minigames everytime they need running so it needs to run multiple times, in order to do that I plan to make it return it to disabled, run the intermission again, and after the intermission it will enable again. It knows when to run when it is enabled and then the If statement checks to ensure it is definitely ready to run

the scripts seems fine

add a print(Value_Stores.Run_Minigame_Selection.Value) before the first “if”.

to make sure that value is true

Nothing from the Output at all from that script;

that means the issue is in whatever is triggering this script

Would it have anything to do with the script that is triggering it being client sided? It’s trying to trigger a script that is in the workspace so it’s Client - Server? I did think that was the issue but the Output for the Local Script says that the Workspace script is enabled, I’ll try to get another script in the server to check whether or not the Workspace script is Disabled

As far as I know, local scripts do not replicate to the server, so, although the local script states that it has enabled the server script, the other clients’ localscripts and the server would state otherwise.

I think there is something called remote events, they can run functions on the server using localscripts. However, I don’t know how they work, you should read about that.

1 Like

I know how to use Remote Events so I might have to use them, I think you’re right though, I should be using an event rather than a Local Script, I’ll try it out now.

If your localScript doesnt use remote events, then that is the issue.

Yeah I just ran a check to see if the script is still disabled even after the Local Script enables it, and it is still disabled, so that is definitely the issue, I’m going to implement the Remote Event to Communicate between the Client and the server now.