Wanted system (GTA)

My script inside of a part with a int value called stars

starcount = script.Parent.Stars.Value

script.Parent.Touched:Connect(function(hit)
local player = game:GetService(“Players”):GetPlayerFromCharacter(hit.Parent)
if player then
player:FindFirstChild(“WantedLevel”).Value = starcount

end

end)

the script in server script service called Wanted Board:

local Players = game:GetService(“Players”)

Players.PlayerAdded:Connect(function(player)
if not player:FindFirstChild(“WantedLevel”) then
local int = Instance.new (“IntValue”,player)
int.Name = “WantedLevel”
end
end)

my script inside of a gui titled wanted gui with a frame with star images titled star1 thru 5:

plr = game.Players.LocalPlayer

wantedLevel = plr:FindFirstChild(“WantedLevel”)
wantedFrame = plr.PlayerGui:FindFirstChild(“WantedGUI”).Frame

wantedLevel.Changed:Connect(function()
for i,v in pairs (wantedFrame:GetChildren()) do
v.Visible = false
end

for count = 1, wantedLevel.Value do
	wantedFrame:FindFirstChild("Star"..count).Visible = true
end

end)

My goal:

When you get the stars that show up on the screen for the players display name to change to therename then amount of stars given in star emoji

also it stopped working earlier

My game file:
WantedStarsLol.rbxl (48.0 KB)

i gues this is what u want to achive

afbeelding

i tested the game but i see no code that links the wanted level to the displayname of the player.
what you want to do is.

when a player joins… wait for the character.
when the character is there save the displayname (character.humanoid.displayname)
if the wanted level in players change. so needs the displayname to storedname+number of :star:

if a player dies or resets the character the new character alsow needs the displayname set

1 Like
starcount = script.Parent.Stars.Value

script.Parent.Touched:Connect(function(hit)
local player = game:GetService(“Players”):GetPlayerFromCharacter(hit.Parent)
if player then
player:FindFirstChild(“WantedLevel”).Value = starcount

end
end)

--the script in server script service called Wanted Board:

local Players = game:GetService(“Players”)

Players.PlayerAdded:Connect(function(player)
if not player:FindFirstChild(“WantedLevel”) then
local int = Instance.new (“IntValue”,player)
int.Name = “WantedLevel”
end
end)

--[[my script inside of a gui titled wanted gui with a frame with star images titled star1 thru 5:]]

plr = game.Players.LocalPlayer

wantedLevel = plr:FindFirstChild(“WantedLevel”)
wantedFrame = plr.PlayerGui:FindFirstChild(“WantedGUI”).Frame

wantedLevel.Changed:Connect(function()
for i,v in pairs (wantedFrame:GetChildren()) do
v.Visible = false
end

for count = 1, wantedLevel.Value do
	wantedFrame:FindFirstChild("Star"..count).Visible = true
end
end)

This might help. To format it like this