generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Script works in solo mode but not when people play the game?

Previous Thread :: Next Thread 
datdude3 is not online. datdude3
Joined: 23 Apr 2010
Total Posts: 577
26 Feb 2014 04:14 PM
repeat wait() until game.Players.LocalPlayer.Character

SS = game.ServerStorage
script.Parent.MouseButton1Down:connect(function()
SS.RS:Clone().Parent = game.Players.LocalPlayer.Backpack
wait(3)
script.Parent.Parent:remove()
end)

--Gives players a regular sword if they click it

repeat wait() until game.Players.LocalPlayer.Character
SS = game.ServerStorage

script.Parent.MouseButton1Down:connect(function()
money = game.Players.LocalPlayer.leaderstats.Money

if game.Players.LocalPlayer.leaderstats.Money.Value >= 4 then
SS.Iced:Clone().Parent = game.Players.LocalPlayer.Backpack
wait(2)
script.Parent.Parent:Destroy()
end
end)

--If you have 4 points it gives you an ice dagger.

pls help i dont kno wat tu du
Report Abuse
fireheart568 is not online. fireheart568
Joined: 04 Jan 2009
Total Posts: 1285
26 Feb 2014 04:38 PM
Most likely problem is that you're not running the code in a LocalScript.

You see, when you Play Solo, everything is run locally, so you can use LocalPlayer and CurrentCamera in a normal script. However, when you play from the website it creates a Server/Client connection, and you can't use local objects like that anymore.
Report Abuse
datdude3 is not online. datdude3
Joined: 23 Apr 2010
Total Posts: 577
26 Feb 2014 04:39 PM
I used local script before it still didn't work.
Report Abuse
fireheart568 is not online. fireheart568
Joined: 04 Jan 2009
Total Posts: 1285
26 Feb 2014 04:40 PM
Also, you cannot access ServerStorage from a LocalScript. Move everything to ReplicatedStorage.
Report Abuse
datdude3 is not online. datdude3
Joined: 23 Apr 2010
Total Posts: 577
26 Feb 2014 04:42 PM
Let me try that then.
Report Abuse
datdude3 is not online. datdude3
Joined: 23 Apr 2010
Total Posts: 577
26 Feb 2014 04:45 PM
My god it worked. YOU ARE A GENIUS SIR I TRULY THANK YOU
Report Abuse
fireheart568 is not online. fireheart568
Joined: 04 Jan 2009
Total Posts: 1285
26 Feb 2014 04:46 PM
No problem.
Report Abuse
datdude3 is not online. datdude3
Joined: 23 Apr 2010
Total Posts: 577
26 Feb 2014 04:47 PM
Uh oh, it breaks. If you die it breaks
Report Abuse
MarioKartAddict is not online. MarioKartAddict
Joined: 11 Nov 2009
Total Posts: 42774
26 Feb 2014 05:12 PM
when you die you could clone the script and delete the previous one
hacky solution but doable
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image