So i was making a special GUI for my character and i wanted to insert a script on it, the thing is: Can i edit a LocalScript's content with a script?
The Script:
script.Parent.ChildAdded:Connect(function() do --Gui Instance.new("ScreenGui") Instance.Name = "Hi" Instance.Parent = game.Players.RedLecko434.PlayerGui --Button Instance.new("TextButton") Instance.Parent = game.Players.RedLecko434.PlayerGui.Hi Instance.Name = "ButtonTxSg" Instance.Position = {0.905, 0},{0.801, 0} --Script Instance.new("LocalScript") Instance.Parent = game.Players.RedLecko434.PlayerGui.Hi.ButtonTxSg end end)
Also if it isnt possible, could something like this work?
script.Parent.ChildAdded:Connect(function() do game.ServerStorage.SampleScirpt:GetChildren("RedLecko434") end end
Good luck.
You cannot edit a Local Script from another script. Also as TheeDeathCaster said, you will want to set the instance as a variable, like this...
local Screen = Instance.new("ScreenGui") Screen.Name = "Hi" Screen.Parent = game.Players.RedLecko434.PlayerGui
And the error with the second script is that you don't need to add a function, you also would want to set it as a variable. It should look like this...
script.Parent.ChildAdded:Connect(function() local children = game.ServerStorage.SampleScirpt:GetChildren() end
Hope that helped.