Local script not running

Hi,
I have a server script that clones a local script into starter gui. Once it is cloned I want it to start running. The server script says name:clone, when I play, I see it cloned from server storage into starter gui. The first line in this local script is

print("Working") 

but it never prints. Anyone know how I can fix this?

When I try it, it works. How are you copying the script into the player? It would help if you showed your code.

You need to parent the local script into the player’s StarterGui. Attempting to put it in the StarterGui service might not work.

U Should set the Local Script.Disabled to true in his properties and then set it to false after cloning it. So in that way the script will only start runing after being cloned.

Are you cloning in the right place? I mean right place like PlayerGui, Playback, PlayerScripts etc.

This is a good idea. I have tried to fix this with

    if humanoid then
			local player = game:GetService("Players"):GetPlayerFromCharacter(humanoid.Parent)
			print(player) --prints my name
            local pla = up:WaitForChild("Pla") --up is the name of the model
			pla.Value = player
			local specialty = game.ServerStorage.NewLocal:Clone()
			specialty.Parent = game.Players.player.PlayerGui

However I get the error player is not a valid member of Players “Players”. How I can fix this?

This didn’t work unfortunately

It’s not

specialty.Parent = game.Players.player.PlayerGui

It’s

specialty.Parent = player.PlayerGui

“player” is a variable. I’m assuming you tried to find it in the Players service. Using game.Players.player would mean asking the Players service to find an instance called “player” in it.
In your code “player” is equal to the player you’re trying to find, which in this case is the player you want to clone the LocalScript into.

1 Like