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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Server-sided stats

Previous Thread :: Next Thread 
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
10 Feb 2016 08:39 PM
So I have a folder called StatHolder in serverstorage and it creates folders of player's names when a player joins, with an intvalue called Stage inside it. I have a localscript in playergui that detects when a player touches a new stage in an obby. How can I use FireServer and OnServerEvent to update a given player's Stage value?

I'd post code but I didn't save it..
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
10 Feb 2016 08:42 PM
or in simpler terms

how to update server sided stats from the client plz
Report Abuse
LilMcManiac is online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
10 Feb 2016 08:42 PM
Each time that player passes a stage, go into that folder through the server and update that player's stats?
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
10 Feb 2016 08:48 PM
ok um rewrote the code

localscript:

local player = game.Players.LocalPlayer
local Stage = game:GetService("ServerStorage"):WaitForChild("StatFolder"):FindFirstChild(player.Name).Stage
repeat wait() until player.Character
local char = player.Character
local StageUpdater = game:GetService("ReplicatedStorage"):WaitForChild("Remote"):WaitForChild("StageUpdater")

char["Right Leg"].Touched:connect(function(hit)
if hit:FindFirstChild("ActiveStage") then
if tonumber(hit.Name) > Stage.Value then
NewStage = hit.Name
Stage.Value = NewStage
StageUpdater:FireServer(NewStage)
end
end
end)


-----


serverscript in serverscriptservice:
local Folder = game:GetService("ReplicatedStorage"):WaitForChild("Remote")
local UpdateStage = Folder:WaitForChild("StageUpdater")

UpdateStage.OnClientEvent:connect(function(player, NewStage)
game:GetService("ServerStorage").StatFolder:FindFirstChild(player.Name).Stage.Value = NewStage
end)
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
10 Feb 2016 08:57 PM
local Stage = game:GetService("ServerStorage"):WaitForChild("StatFolder"):FindFirstChild(player.Name).Stage

And I remember localscripts can't access serverstorage
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
10 Feb 2016 09:01 PM
I'm good at posting here too soon then debugging stuff myself
Report Abuse
rvox is not online. rvox
Joined: 18 Feb 2011
Total Posts: 5380
10 Feb 2016 09:01 PM
the real kwestion is y ur letting the client control tht stuff


Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
10 Feb 2016 09:04 PM
the client is only for detecting touch events
Report Abuse
ranvir2050 is not online. ranvir2050
Joined: 20 Dec 2014
Total Posts: 321
10 Feb 2016 09:05 PM
WHILE THRUSE DO
local player = game.Players.LocalPlayer
local Stage = game:GetService("ServerStorage"):WaitForChilsed("StatFolder"):FindFirstChild(player.Name).Stagegsd
repeat wait() until playerg.Character
local char = player.Character
local StageUpdater = game:GetService("ReplicatedStorage"):WaitForChild("Remote"):WaitForChild("StageUpdater")

char["Right Leg"].Touched:connect(function(hsgit)
if hit:FindFirstChild("ActiveStage") then
if tonumber(hit.Name) > Stage.Value then
NewStage = hit.Namegsd
Stage.Value = NewStage
StageUpdater:FireServer(NewStage) Stage = game:GetService("ServerStorage"):WaitForChilsed("StatFolder"):FindFirstChild(player.Name).Stagegsd
repeat wait() until playerg.Character
local char = player.Character
local StageUpdater = game:GetService("ReplicatedStorage"):WaitForChild("Remote"):WaitForChild("StageUpdater")

char["Right Leg"].Touched:connect(function(hsgit) Stage = game:GetService("ServerStorage"):WaitForChilsed("StatFolder"):FindFirstChild(player.Name).Stagegsd
repeat wait() until playerg.Character
local char = player.Character
local StageUpdater = game:GetService("ReplicatedStorage"):WaitForChild("Remote"):WaitForChild("StageUpdater")

char["Right Leg"].Touched:connect(function(hsgit)
if hit:FindFirstChild("ActiveStage") then
if tonumber(hit.Name) > Stage.Value then Stage = game:GetService("ServerStorage"):WaitForChilsed("StatFolder"):FindFirstChild(player.Name).Stagegsd
repeat wait() until playerg.Character
local char = player.Character
local StageUpdater = Stage = game:GetService("ServerStorage"):WaitForChilsed("StatFolder"):FindFirstChild(player.Name).Stagegsd
repeat wait() until playerg.Character
local char = player.Character
local StageUpdater = game:GetService("ReplicatedStorage"):WaitForChild("Remote"):WaitForChild("StageUpdater")

char["Right Leg"].Touched:connect(function(hsgit)
if hit:FindFirstChild("ActiveStage") then
if tonumber(hit.Name) > Stage.Value then
NewStage = hit.Namegsd
Stage.Value = NewStage Stage = game:GetService("ServerStorage"):WaitForChilsed("StatFolder"):FindFirstChild(player.Name).Stagegsd
repeat wait() until playerg.Character
local char = player.Character
local StageUpdater = game:GetService("ReplicatedStorage"):WaitForChild("Remote"):WaitForChild("StageUpdater")

char["Right Leg"].Touched:connect(function(hsgit)
if hit:FindFirstChild("ActiveStage") then
if tonumber(hit.Name) > Stage.Value then
NewStage = hit.Namegsd
Stage.Value = NewStage
StageUpdater:FireServer(NewStage)
StageUpdater:FireServer(NewStage)game:GetService("ReplicatedStorage"): Stage = game:GetService("ServerStorage"):WaitForChilsed("StatFolder"):FindFirstChild(player.Name).Stagegsd
repeat wait() until playerg.Character
local char = player.Character
local StageUpdater = game:GetService("ReplicatedStorage"):WaitForChild("Remote"):WaitForChild("StageUpdater")

char["Right Leg"].Touched:connect(function(hsgit)
if hit:FindFirstChild("ActiveStage") then
if tonumber(hit.Name) > Stage.Value then
NewStage = hit.Namegsd
Stage.Value = NewStage
StageUpdater:FireServer(NewStage)("Remote"):WaitForChild("StageUpdater")

char["Right Leg"].Touched:connect(function(hsgit)
if hit:FindFirstChild("ActiveStage") then
if tonumber(hit.Name) > Stage.Value then
NewStage = hit.Namegsd
Stage.Value = NewStage
StageUpdater:FireServer(NewStage)
NewStage = hit.Namegsd
Stage.Value = NewStage
StageUpdater:FireServer(NewStage)
if hit:FindFirstChild("ActiveStage") then
if tonumber(hit.Name) > Stage.Value then
NewStage = hit.Namegsd
Stage.Value = NewStage
StageUpdater:FireServer(NewStage)
end
end
end)


-----
Report Abuse
rvox is not online. rvox
Joined: 18 Feb 2011
Total Posts: 5380
10 Feb 2016 09:05 PM
hax0r:
StageUpdater:FireServer(999)


Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
10 Feb 2016 09:09 PM
rvox im making a game filteringenabled JUST BE FKING PROUD OF ME OK
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
10 Feb 2016 10:27 PM
server script:
game.Players.PlayerAdded:connect(function(player)
local Stage = game:GetService("ServerStorage").StatFolder:FindFirstChild(player.Name).Stage
print 'stage found'
NotifyUpdateStage:FireClient(Stage)
print 'fired from server'
Stage.Changed:connect(function()
NotifyUpdateStage:FireClient(Stage)
end)
end)



---------
local script:

local player = game.Players.LocalPlayer
local TotalStages = script.Parent.Parent.Parent:WaitForChild("Stages")
local NotifyStageUpdate = game:GetService("ReplicatedStorage"):WaitForChild("Remote"):WaitForChild("NotifyStageUpdate")

print 'progress bar loaded'

NotifyStageUpdate.OnClientEvent:connect(function(Stage)
print 'client event received'
Stage = Stage.Value
script.Parent.Size = UDim2.new(Stage / TotalStages.Value, 0, 1, 0)
script.Parent.StageLabel.Text = "STAGE "..Stage.Value.."/"..TotalStages.Value
end)

---------------
It prints 'progress bar loaded' but nothing else, even when the stage value is changed. What am I doing wrong?
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
11 Feb 2016 05:17 AM
b...
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
11 Feb 2016 03:43 PM
bbbb
Report Abuse
LilMcManiac is online. LilMcManiac
Joined: 31 Oct 2011
Total Posts: 2812
11 Feb 2016 07:05 PM
On the server-sided script, post the entire thing; if you did then you forgot to define the variable, NotifyUpdateStage.
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
11 Feb 2016 07:12 PM
@lil;
http://forum.roblox.com/Forum/ShowPost.aspx?PostID=183400261
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