How do i make something that can only be called on server side local

I am trying to make the changes from this badge check script local.
the script works, but the changes aren’t local. How would I do this?

local BadgeService = game:GetService("BadgeService")
local Players = game:GetService("Players")

local badgeID = script.Parent.BadgeId.Value

local function onPlayerAdded(player)
	local success, hasBadge = pcall(function()
		return BadgeService:UserHasBadgeAsync(player.UserId, badgeID)
	end)
	if not success then
		return
	end

	if hasBadge then
		script.Parent.BrickColor = BrickColor.new("Bright green")
	end
end
Players.PlayerAdded:Connect(onPlayerAdded)

If it’s server sided, it replicates to all clients. Can you try doing

	if not success then
		return print("did not work")
	end

And see if it prints that?

yes, all changes are server sided

use remote events, pass the brickcolor from the server and use a local script to get that color