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

The tool giver script only works in solo mode, how do I fix it?

Asked by 8 years ago
Edited 8 years ago
01local Gui = script.Parent
02local player = game.Players.LocalPlayer
03function 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.BackgroundColor3= Color3.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!"
View all 28 lines...

1 answer

Log in to vote
1
Answered by
Suamy 68
8 years ago

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.

0
I also suggest using WaitForChild for your tools. http://wiki.roblox.com/index.php?title=API:Class/Instance/WaitForChild Suamy 68 — 8y
0
Thank you funkennethmbah 30 — 8y
Ad

Answer this question