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

why does this works in SOLO play but not in the actual game?!?!

Ok, so this script is not actually mine, it is builderman's, but i edited it, and made my own attachments to it, but for some reason it only works in SOLO play in studio, Why is that!!! here is the script

--Basics of this script was taken from Builderman's ROBLOXtablet --yogipanda123

local gui = script.Parent.ScreenGUI:Clone()

function Equip()
	gui.Parent = game.Players.LocalPlayer.PlayerGui
end

function Unequip()
	gui.Parent = nil
end

script.Parent.Equipped:connect(Equip)
script.Parent.Unequipped:connect(Unequip)

thanks to whoever answers this!

2 comments

0

LocalScript or Server-Sided script? :)

0

Use a LocalScript.

2 answers

✓ Accepted answer

Add wait(.5) to the top, local scripts load faster than the character loads. Thumbs up if it worked.

One up DawnHorizon who answered correctly (I'm basing this edited comment after reading his theory which works :D).

If you have many scripts like me, just make a script that waits 1/2 seconds then scans a list of scripts and enables them. Previously disable all of them before uploading. Here is a code snippet of what I did:

wait(.5) -- Allows player to load

player = game.Players.LocalPlayer --Local Player
gui = player.PlayerGui
scriptsToLoad = {gui.Blah, gui.MoreBlah, gui.Sweet} -- List of scripts (this form gives the object)

for num, obj in pairs(scriptsToLoad) do -- Scans the entire list of scripts we added earlier
	obj.Disabled = true -- This disables the script, I would recommend just disabling them in the game 					not using this script.
	wait(0.01) -- Waits a little.
	obj.Disabled = false -- This enables the script.
end -- Done

This should help if you have many scripts you want to fix :D

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