Free Halo Giver System

I am trying to make a level system where if you reach a certain level you will get a halo. First I am trying to give the halo which everybody gets which is the halo you get in level 0. The script I have made I think should work but for some reason it doesn’t. I do not see the problem.
local player = game.Players.LocalPlayer
local Level = player:WaitForChild(“levels”)

game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function()

  if Level.Value >= 0 then
  	local Halo = game.ServerStorage.HaloFree:Clone()
  	Halo.Parent = Player.Character
  end

end)
end)
This script is in SSS and is a normal script…

its just checking the level when they join, you need to check whenever level changes, use .Changed then do the if statement on change.

then is everything else fine? If I change to .Changed then does it work?

I mean, you could literally handle the code on the server side and I’m pretty sure it’ll work that way (But not the LocalPlayer variable)

And I’d recommend changing the detection for the Level to a Changed event instead

I dont understand… Can you further explain?

The code you sent is fine, but it could be better if you were to change it to the Server-Sided point of view:

game.Players.PlayerAdded:Connect(function(Player)
    local Level = player:WaitForChild("Level")
    Level.Changed:Connect(function() --This basically fires every time the Level Value is changed
         if Level.Value >= 0 then
             local Halo = game.ServerStorage.HaloFree:Clone()
             Halo.Parent = Player.Character
         end
    end)
end)

Something along like this would do (And yes the formatting is bad cause mobile exists)

Make sure to also check if the player has the halo on join, like this, the player will only reveive the halo when the level value has changed, you may also want to give the player the halo upon joining.

1 Like

Yes,

local value = myVal -- just define the int value, not the number

value.Changed:Connect(function()
    -- add if statement and stuff
end)

Have it server sided too!