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

Why edited by me script doesn't work?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

Help me! I edited script for time played in game (leaderboard) by adding part of script for cash (again for leaderboard) and it's not working. (Script stops giving time played after 3 seconds.) I maked it in my new game (Again new game...) Mega Ultimate Obby (everyone knows it's in Roblox)

I want to make leaderboard with time played counter and with cash.

Script:

function onPlayerEntered(newPlayer)
    local stats = Instance.new("IntValue")
    stats.Name = "leaderstats"
    local cash = Instance.new("IntValue")             
    cash.Parent = stats 
    cash.Name = "Cash"
    cash.Value = 0
    local captures = Instance.new("IntValue")
    captures.Name = "Time Played"
    captures.Value = 0
    captures.Parent = stats
    stats.Parent = newPlayer
    wait(1)
    captures.Value=captures.Value+1
    wait(1)
    captures.Value=captures.Value+1
    wait(1)
    captures.Value=captures.Value+1

end

game.Players.ChildAdded:connect(onPlayerEntered)

And second local script that's in that script up (Not edited) (Idk what it does):

while wait(1) do
    game.Players.LocalPlayer.leaderstats["Time Played"].Value=game.Players.LocalPlayer.leaderstats["Time Played"].Value+1
end 

Original script (Not edited):

function onPlayerEntered(newPlayer)
    local stats = Instance.new("IntValue")
    stats.Name = "leaderstats"
    local captures = Instance.new("IntValue")
    captures.Name = "Time Played"
    captures.Value = 0
    captures.Parent = stats
    stats.Parent = newPlayer
     wait(1)
     captures.Value=captures.Value+1
     wait(1) 
     captures.Value=captures.Value+1
     wait(1)
     captures.Value=captures.Value+1
     workspace.LinkedLeaderboard["Time Playing Counter"]:Clone().Parent=newPlayer.Backpack
     workspace.LinkedLeaderboard["Time Playing Counter"]:Clone().Parent=newPlayer.StarterGear
end

game.Players.ChildAdded:connect(onPlayerEntered)
0
english do how grammer right? minikitkat 687 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

i think i might have you answer

function onPlayerEntered(newPlayer)
    local stats = Instance.new("IntValue")
    stats.Name = "leaderstats"
    local cash = Instance.new("IntValue")             
    cash.Parent = stats 
    cash.Name = "Cash"
    cash.Value = 0
    local captures = Instance.new("IntValue")
    captures.Name = "Time Played"
    captures.Value = 0
    captures.Parent = stats
    stats.Parent = newPlayer
  while true do

     wait(1)
    captures.Value=captures.Value+1
    wait(1)
    captures.Value=captures.Value+1
    wait(1)
    captures.Value=captures.Value+1
end

end

game.Players.ChildAdded:connect(onPlayerEntered)

Ad

Answer this question