Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I move a script into a player if they are on the name list?

I have no clue how to get a script to move into a player when they join if they are on the list.

I have no clue what is wrong with this, so please help. (The script that I need to move into them and execute is a local script, and does not work in workspace, it only works in StarterCharacterScripts, so should I try and do something like script.TheScript.Parent == game.Players.EliteJcoombs.Character?)

game.Players.PlayerAdded:connect(function(player)
	if game.Players.Name == "EliteJcoombs" then
	script.TheScript.Parent = game.Players.EliteJcoombs
	end
end)

1 comment

0

Please put your code in a codeblock. It's the button with the Lua logo on it.

1 answer

✓ Accepted answer

Try making this:

game.Players.PlayerAdded:connect(function()
	local plr = game.Players.LocalPlayer
	
	--[[
	use this if you want
	its a delay

	wait(0.3)
	]]--
	
	local scriptlocation = game.Workspace.Script -- put here the location of your script

	scriptlocation:Clone().Parent = game.Workspace[plr.Name]
	
end)

I hope this helped (^_^)v

1 comment

0

I need the script to move into a player so that it runs as if it was in StarterCharacterScripts, thanks.

This discussion is preserved as it was. New answers, comments, and votes are closed.