Script not processing gui

Hey devs,

I am currently working on a game and it supports PC & mobile, when a player joins the game either on mobile or PC, a script gets a gui from replicatedstorage and parents it to PlayerGui.

The problem is that some of the scripts from Serverscriptservice attempt to detect the gui from mobile or PC before the script that parents the guis actually begins.

How can I fix this?

Could you share the code that detects and parents the GUI?

2 Likes

Sure, the script that does this is located in StarterPlayer scripts (Script was not made by me)

local plr = game.Players.LocalPlayer
local inputService = game:GetService("UserInputService")



if inputService.TouchEnabled and not inputService.KeyboardEnabled then
	

	game:WaitForChild("ReplicatedStorage"):WaitForChild("Platforms"):WaitForChild("Mobile"):WaitForChild("Guithing"):clone().Parent = plr:WaitForChild("PlayerGui")
	game:WaitForChild("ReplicatedStorage"):WaitForChild("Platforms"):WaitForChild("Mobile"):WaitForChild("SafeZoneGui"):clone().Parent = plr:WaitForChild("PlayerGui")
	game:WaitForChild("ReplicatedStorage"):WaitForChild("Platforms"):WaitForChild("Mobile"):WaitForChild("CameraGui"):clone().Parent = plr:WaitForChild("PlayerGui")
	game:WaitForChild("ReplicatedStorage"):WaitForChild("Platforms"):WaitForChild("Mobile"):WaitForChild("AvatarEditor"):clone().Parent = plr:WaitForChild("PlayerGui")

	
elseif inputService.GamepadEnabled and not inputService.KeyboardEnabled then
	

	game:WaitForChild("ReplicatedStorage"):WaitForChild("Platforms"):WaitForChild("Console"):WaitForChild("Guithing"):clone().Parent = plr:WaitForChild("PlayerGui")
	
	
else
	

	game:WaitForChild("ReplicatedStorage"):WaitForChild("Platforms"):WaitForChild("PC"):WaitForChild("Guithing"):clone().Parent = plr:WaitForChild("PlayerGui")
	game:WaitForChild("ReplicatedStorage"):WaitForChild("Platforms"):WaitForChild("PC"):WaitForChild("SafeZoneGui"):clone().Parent = plr:WaitForChild("PlayerGui")
	game:WaitForChild("ReplicatedStorage"):WaitForChild("Platforms"):WaitForChild("PC"):WaitForChild("CameraGui"):clone().Parent = plr:WaitForChild("PlayerGui")
	game:WaitForChild("ReplicatedStorage"):WaitForChild("Platforms"):WaitForChild("PC"):WaitForChild("AvatarEditor"):clone().Parent = plr:WaitForChild("PlayerGui")
end


wait(10)
script:destroy()

Any help is still appreciated!

is your script in serverscriptservice?

The script that parents the guis is in Starterplayer scripts.

The script that breaks because it runs before the script that parents is in Serverscriptservice

1 Like

the script that parents the gui, is it a local script?

Yeah, it’s a local script located in Starterplayer scripts.

okay i’m not sure if you made any errors in the coding or the scripts, could you send me a model of this, i think i’ve had this same similiar problem!

How can I send you the model???

Watch this:

How to create and export models in Roblox!

1 Like

Here’s the link:

okay, i got the model, now let me check the problem!

1 Like

Am afraid I have to log off, a solution is appreciated very much.