local Gui = script.Parent local player = game.Players.LocalPlayer function sw() if Gui.Parent.Text == "Room is Fit" then Gui.Parent.Text = "You will recieve the key in a few seconds" wait(3) Gui.Parent.Text = "Room is checked out!" Gui.BackgroundColor3= Color3.new(170,0,0) game.ServerStorage.Flashlight:Clone() game.ServerStorage.Flashlight.Parent = player.Backpack player.Backpack.Flashlight.Name = "k" else Gui.Parent.Text = "Room is checked out!" end end Gui.MouseButton1Down:connect(sw) game.Players.PlayerRemoving:connect(function(player) if player.Backpack.Flashlight.Name == "k" then Gui.Parent.Text = "Room is fit" Gui.BackgroundColor3= Color3.new(0,170,0) end end)
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.