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 » Scripters
Home Search
 

Work in Solo , not in Server

Previous Thread :: Next Thread 
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
03 Jan 2016 07:04 PM
I tried to make a Stamina bar , it perfectly work in Solo there are no error at all.When I try it on local Server , there are 2 major errors.

1st: The Stats Folder isn't created by the ServerScriptService and since it isn't created the Stamina IntValue isn't created as well.

2nd:Since these two doesn't exist , the really basic script , doesn't work and sprinting doesn't work anymore.

That's just the script to load the value , when the player joins the game:
game.Players.PlayerAdded:connect(function(player)
player = game.Players.LocalPlayer

local Stats = Instance.new("Folder")
Stats.Parent = player
Stats.Name = "Stats"

local Stamina = Instance.new("IntValue")
Stamina.Parent = Stats
Stamina.Name = "Stamina"
Stamina.Value = 100

end)

The Output error state:
20:02:52.844 - Stats is not a valid member of Player
20:02:52.844 - Script 'Players.Player2.PlayerGui.StatsGui.Box.StamBar.LocalScript', Line 4
20:02:52.845 - Stack End

I'm not sure if it is because the value hasn't loaded , because when I go check the folder , they aren't even there , so I wasn't sure if it was the ServerScriptService who had an error or the Stamina Bar. I tried the player:waitForCharacter() and it didn't worked as well.

Thanks for helping me out , I'm still a beginner.
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
03 Jan 2016 07:05 PM
>Can't access local player through a server script.



Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
03 Jan 2016 07:07 PM
So how do I make it? I tried to make a local script , but since they can't be put in ServerScript it haven't work either. What should I do?
Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
03 Jan 2016 07:08 PM
You've already got the player in the playeradded event:

game.Players.PlayerAdded:connect(function(player)
if player then

end
end)



Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
03 Jan 2016 07:10 PM
^you dont need "if player then"


Report Abuse
AdvancedObjects is not online. AdvancedObjects
Joined: 11 Dec 2012
Total Posts: 3354
03 Jan 2016 07:12 PM
^ It's a bad habit, lol.



Report Abuse
ColonySimulator is not online. ColonySimulator
Joined: 05 Jul 2015
Total Posts: 1721
03 Jan 2016 07:14 PM
Thanks for the help, it work right now. Wow this error was so freaking foolish , I was so blind. Maybe that the error that broke my other STR game x_x
Report Abuse
BlueKeyblades is not online. BlueKeyblades
Joined: 11 Oct 2014
Total Posts: 220
03 Jan 2016 07:25 PM
^ if player and player:IsA('Player') then
Gotta make sure it isnt a supercomputer.

[Work not tested, not bested.]
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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