| |
|
| |
|
|
| 17 Oct 2015 01:59 PM |
Depends, if you want a brick to give you points, heres what I would use (instert a local script into a part)
repeat wait() player = game.Players.LocalPlayer leaderboard = player.leaderstats until points = 5 function givePoints() leaderboard.Points.Value = leaderboard.Points.Value + points --Might need to change this depending on what you called your leaderstat for the points. end script.Parent.Touched:connect(givePoints) |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2015 02:01 PM |
| What if I want to detect if player has like 4 kills? |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2015 02:02 PM |
FACEPALM Read the wrong thing... (normal script) function getPoints() local player = game.Players.LocalPlayer local points = player.leaderstats.Points end script.Parent.Touched:connect(getPoints) |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2015 02:05 PM |
If you wanna detect the player has 4 kills, use a normal script.
function detect() local playerleads = game.Player.LocalPlayer.leaderstats.Kills if playerleads.Value >= 4 then print("Run your code here.") end end script.Parent.Touched:connect(detect) |
|
|
| Report Abuse |
|
|
GrandSnaf
|
  |
| Joined: 28 Mar 2015 |
| Total Posts: 111 |
|
|
| 17 Oct 2015 02:05 PM |
while true do wait() for _,player in pairs(game.Players:GetPlayers()) do if player:FindFirstChild("leaderstats") then local stats = player.leaderstats if stats:FindFirstChild("Kills") then local kills = stats.kills if kills.Value == 4 then
end end end end end |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2015 02:05 PM |
function getPoints() local player = game.Players.LocalPlayer local kills = player.leaderstats.Kills end script.Parent.Touched:connect(getPoints)
So if kills == 4 then do this and that? |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2015 02:07 PM |
| It's the simplest way. People just make it so hard... |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2015 02:15 PM |
i cant grasp the concept
i did this wrong at the bottom
how do i make it so when player has 4 kills it changes the rank
game.Players.PlayerAdded:connect(function(player) local statsFolder = Instance.new("Folder", player) statsFolder.Name = "leaderstats" local cash = Instance.new("IntValue", statsFolder) cash.Name = "Kills" local rank = Instance.new("StringValue", statsFolder) rank.Name = "Rank" end)
while true do wait() for _,player in pairs(game.Players:GetPlayers()) do if player:FindFirstChild("leaderstats") then local stats = player.leaderstats if stats:FindFirstChild("Kills") then local kills = stats.kills if kills.Value == 4 then stats:FindFirstChild("Rank") == ("Level 1")
end end end end end |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2015 02:21 PM |
| @iPad Leave, you just told him to put a script, that uses LocalPlayer, inside of a server-side script. |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2015 02:23 PM |
>.< im so confused
so should i be using reg script or local script |
|
|
| Report Abuse |
|
|
GrandSnaf
|
  |
| Joined: 28 Mar 2015 |
| Total Posts: 111 |
|
|
| 17 Oct 2015 02:29 PM |
| Epic, stats:FindFirstChild("Rank") == ("Level 1") should be stats:FindFirstChild("Rank").Value = stats:FindFirstChild("Rank").Value + 1 |
|
|
| Report Abuse |
|
|
GrandSnaf
|
  |
| Joined: 28 Mar 2015 |
| Total Posts: 111 |
|
|
| 17 Oct 2015 02:31 PM |
im sorry, it should be stats:FindFirstChild("Rank").Value = "Rank 1"
sorry :3 |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Oct 2015 02:43 PM |
Okay now for math
in lua how do I make it so if kills is between 4 and 12 then we do this? |
|
|
| Report Abuse |
|
|
GrandSnaf
|
  |
| Joined: 28 Mar 2015 |
| Total Posts: 111 |
|
|
| 17 Oct 2015 02:45 PM |
if Kills.Value > 4 and Kills.Value < 12 then
end |
|
|
| Report Abuse |
|
|
GrandSnaf
|
  |
| Joined: 28 Mar 2015 |
| Total Posts: 111 |
|
| |
|
|
| 17 Oct 2015 03:12 PM |
| How do i put a loop so it checks how many kills the player have? |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2015 03:13 PM |
while true do wait() for _,player in pairs(game.Players:GetPlayers()) do if player:FindFirstChild("leaderstats") then local stats = player.leaderstats if stats:FindFirstChild("Kills") then local Kills = stats.Kills if Kills.Value == 0 then stats:FindFirstChild("Rank").Value = "Citizen" elseif Kills.Value > 4 and Kills.Value < 12 then stats:FindFirstChild("Rank").Value = "Soilder" else print("..")
end end end end end |
|
|
| Report Abuse |
|
|
|
| 17 Oct 2015 03:23 PM |
isnt this suppose to be on a loop anyways? it has while true do |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|