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)
✓ ANSWER ACCEPTED
The tool giver script only works in solo mode, how do I fix it?
1 answer
✓ Accepted answer
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.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
I also suggest using WaitForChild for your tools. http://wiki.roblox.com/index.php?title=API:Class/Instance/WaitForChild
Thank you