Im adding a viewmodel to my character when I press a gui button the viewmodel is in replicated storage, when I just put the viewmodel in starter character scripts it works fine but when I add it to my character with the gui button the server script does not work. Any help?
Is the GUI button a local or server script?
If it’s local, then you cannot clone a server script with a local script and have it work.
local so how will I clone it then?
Use a remote event, client → server and have that server clone it for that player.
Or you could replace the GUI button click event with a server script.
I have no idea what your setup is, just be aware that scripts only run under certain scenarios which cause a silent problem.
You can only use local scripts to change things client sided, so if its not replicated, you shouldn’t use it unless you are trying to make the client have something other clients don’t intentionally. What you mostly use the local scripts is generally communication with the server and GUI, at least that’s what I do.
Additionally, Localscripts are in your computer/Client, while the Serverscripts are in your Server. Which means they can only access what they have on that side. Client doesn’t have access ServerScriptService nor ServerStorage, so it has to request the needed files that are in those areas from a ServerScript.
Get a remote event and make the local script fire that remote event when you need the GUI, the serverscript will receive the event and clone the event to the PlayerGUI of the player.
Or, you can have the GUI in ReplicatedStorage, which you can take from whenever you want.
You can read about more in developer.roblox.com or create.roblox.com