Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

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

Asked by 10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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!

0
LocalScript or Server-Sided script? :) TheeDeathCaster 2368 — 10y
0
Use a LocalScript. MessorAdmin 598 — 10y

2 answers

Log in to vote
4
Answered by 10 years ago

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

Ad
Log in to vote
0
Answered by 10 years ago

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

Answer this question