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

Why won't my gui that gives tools work in Play Solo but not online?

Asked by
camxd01 48
6 years ago
Edited 6 years ago

My script's main job is to give the player who clicked a text button a key card to get into their hotel room. The Step-by-Step of the process is you step on a button, which triggers a script in their to copy a gui from ServerStorage,then a gui pops up, and you click on of the text buttons on the gui and it gives you the corresponding room keycard by also cloning it from ServerStorage. The main Gui pops up how its supposed to, but if I click a button it does nothing. It works fine in play solo and run, and it shows no errors in real game(I used HotThoth's Remote Error Monitor Script for this information.)The format of the of the textbuttons is here: gyazo.com/2c2d139fb2310d0d73c810653dd13f44 The code inside each of the textbuttons is(local scripts):

--*print("Made by CamScripted")*
local key
local ss = game.ServerStorage

function onClick(click)
local key = ss.Room3:Clone()--Room3 is changed to whatever number room I click and I tried removing the local since it was already stated but that didnt work.
--Also game.Players[click.Name].Character doesn't work, but I don't think I did that right since it didnt work in Studio either. 
key.Parent = game.Players.LocalPlayer.Character--I tried changing to script.Parent.Parent.Parent.Parent.Parent.Character, but that only worked studio as well
wait(1)
script.Parent.Parent.Parent:Destroy()
end

script.Parent.MouseButton1Click:Connect(onClick)

Thank you in advance.

1 answer

Log in to vote
1
Answered by 6 years ago

A local script cannot open ServerStorage. It can open ReplicatedStorage, though. The reason it works on Play Solo is because it works differently. So just replace ServerStorage with ReplicatedStorage.

0
Thanks, I used to only use lighting so I don't have much practice the ServerStorage camxd01 48 — 6y
Ad

Answer this question