|
| 03 Aug 2016 11:27 AM |
Guys help I cannot detect player name and change rank of it.
Here is the original script.
game.Players.PlayerAdded:connect(function(player) local stats = Instance.new('IntValue', player) stats.Name = 'leaderstats' local rank = Instance.new('StringValue', stats) rank.Name = 'Rank' rank.Value = 'Visitor' local attime = Instance.new('IntValue', stats) attime.Name = 'Time' attime.Value = 0 if game.Players.LocalPlayer.Name == 'Anthony9299' then player.leaderstats.Rank.Value = "Host" end while true do wait(1) attime.Value = attime.Value + 1 end end) |
|
|
| Report Abuse |
|
|
triode
|
  |
| Joined: 13 Aug 2011 |
| Total Posts: 5844 |
|
|
| 03 Aug 2016 11:31 AM |
| You forgot to parent the values into the player |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 11:37 AM |
| What do you mean...? I don't actually understand... Sorry :/ |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 11:43 AM |
playeradded only works in serverscripts localplayer only works in localscript
This siggy is copyrighted © |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 11:48 AM |
| Still now specific... Just tell me how to detect a specific player name ;_; |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 11:54 AM |
I think this might help. player = game.Players:FindFirstChild("Anthony9299")
if player then rank.Value = "Host"
(FYI this rank.Value will not work. Just a demonstration.) |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 12:00 PM |
| There is only one problem... I still cannot change it :P |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 12:05 PM |
| what do you mean you cannot change the name. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2016 12:17 PM |
Here is a script that I know about that will actually help you. Playerstats = {}
game.Players.PlayerAdded:connect(function(player)
Playerstats[player] = {} Playerstats[player]['Rank'] = 0
local stats = Instance.new("Model", player) stats.Name = "Stats"
local rank = Instance.new("IntValue", stats) rank.Name = "Rank" rank.Value = Playerstats[player]['Rank'] end)
while wait() do for _, player in ipairs(game.Players:GetPlayers())do player.stats.rank.Value = Playerstats[player]['Rank'] + 1
if player:FindFirstChild('Playerstats') then Playerstats[player]['Rank'] = Playerstats[player]['Rank'] end end end |
|
|
| Report Abuse |
|
|
peIicans
|
  |
| Joined: 02 Nov 2013 |
| Total Posts: 1148 |
|
|
| 03 Aug 2016 12:21 PM |
server script, serverscriptstorage
game.Players.PlayerAdded:connect(function(player) local stats = Instance.new('IntValue', player) stats.Name = 'leaderstats' local rank = Instance.new('StringValue', stats) rank.Name = 'Rank' rank.Value = 'Visitor' local attime = Instance.new('IntValue', stats) attime.Name = 'Time' attime.Value = 0 if player.Name == 'Anthony9299' then player.leaderstats.Rank.Value = "Host" end while true do wait(1) attime.Value = attime.Value + 1 end end)
|
|
|
| Report Abuse |
|
|