01 | local Gui = script.Parent |
02 | local player = game.Players.LocalPlayer |
03 | function sw() |
04 | if Gui.Parent.Text = = "Room is Fit" |
05 |
06 | then |
07 | Gui.Parent.Text = "You will recieve the key in a few seconds" |
08 | wait( 3 ) |
09 | Gui.Parent.Text = "Room is checked out!" |
10 | Gui.BackgroundColor 3 = Color 3. new( 170 , 0 , 0 ) |
11 | game.ServerStorage.Flashlight:Clone() |
12 | game.ServerStorage.Flashlight.Parent = player.Backpack |
13 | player.Backpack.Flashlight.Name = "k" |
14 | else |
15 | Gui.Parent.Text = "Room is checked out!" |
If you are using a Normal Script, LocalPlayer will not work in the real Play mode. It only works in Test Mode because the client and server are joined.
Use a local script instead, and move it from ServerStorage to ReplicatedStorage, as LocalScripts cannot access ServerStorage.