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

Leaderboard Kills/Level up, help?

Asked by 6 years ago

I am making a battle royale game and... after you get a kill you see what you will be awarded with but I don't know what to use to connect the function with the game. Also, at line 33 = is underlined with a red colour, help?

01local kills = Instance.new("IntValue")
02local deaths = Instance.new("IntValue")
03local credits = Instance.new("IntValue")
04local level = Instance.new("IntValue")
05local wins = Instance.new("IntValue")
06 
07kills.Name = "Kills"
08deaths.Name = "Deaths"
09credits.Name = "Credits"
10level.Name = "Level"
11wins.Name = "Wins"
12 
13kills.Value = 0
14deaths.Value = 0
15credits.Value = 0
View all 39 lines...
0
Because it's wins.Value == 2 not = 2 User#19524 175 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago

the = operator SETS a variable, not compare

the == operator COMPARES two values and returns a boolean, as hulabee and incapaz are pointing out

also, trying to detect a kill is very hard, i would suggest adding code at where the tools (weapons) do damage to a humanoid, by adding an "if" for when the the health is taken for detecting if the health is <= 0 and sending a message to this script perhaps via RemoteEvents that the player has killed another player, and connect onKill with the message

Ad
Log in to vote
0
Answered by 6 years ago

Try replacing line 33 with this code.

if wins.Value == 2

0
Comment. User#19524 175 — 6y

Answer this question