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: Something is Really Wrong with this Script

Previous Thread :: Next Thread 
Corenought is not online. Corenought
Joined: 22 Dec 2009
Total Posts: 186
03 Oct 2013 10:27 PM
Most of this stuff in the middle doesn't matter but the script just doesn't even do anything though, it theoretically should. The stats should be in the Player but nope, nothing happens.


function CreateStats(Player)
wait(1)
Stats = Instance.new("Configuration")
Stats.Name = "Stats"
Stats.Parent = Player
CharacterStats = Instance.new("Configurtion")
CharacterStats.Parent = Stats
Level = Instance.new("NumberValue")
Level.Parent = CharacterStats
Level.Name = "Level"
Level.Value = 1
Experience = Instance.new("NumberValue")
Experience.Parent = CharacterStats
Experience.Name = "Experience"
Experience.Value = 0
Gold = Instance.new("NumberValue")
Gold.Parent = CharacterStats
Gold.Name = "Gold"
Gold.Value = 0
MaxHealth = Instance.new("NumberValue")
MaxHealth.Parent = CharacterStats
MaxHealth.Name = "MaxHealth"
MaxHealth.Value = 100
MaxStamina = Instance.new("NumberValue")
MaxStamina.Parent = CharacterStats
MaxStamina.Name = "MaxStamina"
MaxStamina.Value = 100
MaxMana = Instance.new("NumberValue")
MaxMana.Parent = CharacterStats
MaxMana.Name = "MaxMana"
MaxMana.Value = 100
CurrentHealth = Instance.new("NumberValue")
CurrentHealth.Parent = CharacterStats
CurrentHealth.Name = "CurrentHealth"
CurrentHealth.Value = 100
CurrentStamina = Instance.new("NumberValue")
CurrentStamina.Parent = CharacterStats
CurrentStamina.Name = "CurrentStamina"
CurrentStamina.Value = 100
CurrentMana = Instance.new("NumberValue")
CurrentMana.Parent = CharacterStats
CurrentMana.Name = "CurrentMana"
CurrentMana.Value = 100
HealthMod = Instance.new("NumberValue")
HealthMod.Parent = CharacterStats
HealthMod.Name = "HealthMod"
HealthMod.Value = 0
StaminaMod = Instance.new("NumberValue")
StaminaMod.Parent = CharacterStats
StaminaMod.Name = "StaminaMod"
StaminaMod.Value = 0
ManaMod = Instance.new("NumberValue")
ManaMod.Parent = CharacterStats
ManaMod.Name = "ManaMod"
ManaMod.Value = 0
SpeedMod = Instance.new("NumberValue")
SpeedMod.Parent = CharacterStats
SpeedMod.Name = "SpeedMod"
SpeedMod.Value = 0
TempHealthMod = Instance.new("NumberValue")
TempHealthMod.Parent = CharacterStats
TempHealthMod.Name = "TempHealthMod"
TempHealthMod.Value = 0
TempStaminaMod = Instance.new("NumberValue")
TempStaminaMod.Parent = CharacterStats
TempStaminaMod.Name = "TempStaminaMod"
TempStaminaMod.Value = 0
TempManaMod = Instance.new("NumberValue")
TempManaMod.Parent = CharacterStats
TempManaMod.Name = "TempManaMod"
TempManaMod.Value = 0
TempSpeedMod = Instance.new("NumberValue")
TempSpeedMod.Parent = CharacterStats
TempSpeedMod.Name = "TempSpeedMod"
TempSpeedMod.Value = 0
GlobalStats = Instance.new("Configurtion")
GlobalStats.Parent = Stats
UserStats = Instance.new("Configurtion")
UserStats.Parent = Stats
end

game.Players.ChildAdded:connect(CreateStats)
Report Abuse
Smakdown21 is not online. Smakdown21
Joined: 15 Dec 2009
Total Posts: 1552
03 Oct 2013 10:29 PM
Where are you testing this script? Play Solo?
Report Abuse
Corenought is not online. Corenought
Joined: 22 Dec 2009
Total Posts: 186
03 Oct 2013 10:30 PM
Yeah, Solo.
Report Abuse
randomsmileyface is online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
03 Oct 2013 10:34 PM
CreateStats(Player) is a Roblox function?
Report Abuse
randomsmileyface is online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
03 Oct 2013 10:34 PM
oh nvm...
Report Abuse
Smakdown21 is not online. Smakdown21
Joined: 15 Dec 2009
Total Posts: 1552
03 Oct 2013 10:37 PM
Your character is loading before the script, so if you test this in a simulated server, it should work.
Report Abuse
randomsmileyface is online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
03 Oct 2013 10:37 PM
oh here, its the same deal with tycoons:
PlayerAdded doesn't work as you want it to in play solo

instead it being the playeradded event, just start it out as an argument waiting for Player1

heres an example I use with tycoons: feel free to edit how you want

local test = game.Players:FindFirstChild("Player1")
if test ~= nil then
wait(.5)
local stats = Instance.new("IntValue")
stats.Name = "leaderstats"
local stats2 = Instance.new("IntValue")
stats2.Name = "Tycoon"

local cash = Instance.new("IntValue")

cash.Name = "Cash"
cash.Value = 100 -- This is how much money each player gets when they start the game. You can change it if you want to.

cash.Parent = stats
stats2.Parent = test
stats.Parent = test
end
Report Abuse
Smakdown21 is not online. Smakdown21
Joined: 15 Dec 2009
Total Posts: 1552
03 Oct 2013 10:39 PM
Don't add what random says, it doesn't matter what happens in Play Solo, as long as it works in the real game.
Report Abuse
XAXA is not online. XAXA
Joined: 10 Aug 2008
Total Posts: 6315
03 Oct 2013 10:43 PM
Remember -- always test the final script in Online Mode!
Report Abuse
randomsmileyface is online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
03 Oct 2013 10:49 PM
Instance.new("Configuration")?

theres your first problem
Report Abuse
Corenought is not online. Corenought
Joined: 22 Dec 2009
Total Posts: 186
03 Oct 2013 10:53 PM
random, please learn more about scripting before you make suggestions on the Scripting Forum. This script should, in theory, create all stats.
Report Abuse
randomsmileyface is online. randomsmileyface
Joined: 01 Aug 2010
Total Posts: 4538
03 Oct 2013 11:00 PM
I meant the typo "Configurtion"

oops

and to make any stat script to run in play solo(for testing purposes, only works in solo)
remove the
function Whateverfunctionyoucallit(newPlayer)

replace it with


local test = game.Players:FindFirstChild("Player1")
if test ~= nil then

and remove the function call
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