Roblox Ignor Of Value Changed

game.Players.PlayerAdded:Connect(function(plr)
	MPS.ProcessReceipt = function(receiptInfo)
		if receiptInfo.ProductId == DevProducts.ColorAllPalette then
			for _, ColorParts in pairs(ColorableParts:GetChildren()) do
				local PlrColor = plr:WaitForChild("PlayerColor").Value
				ColorParts.Color = PlrColor
			end
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	
end)

My Code Must Change The Color of Parts, but code changing on black color, so in player value - PlayerColor is always changing

Roblox just takes value only 1 time, when loaded, i guess, how to fix that?

1 Like

Because you need to connect it to Changed or GetPropertyChangedSignal event:

game.Players.PlayerAdded:Connect(function(plr)
    local function update()
        local PlrColor = plr:WaitForChild("PlayerColor").Value
        for _, ColorParts in pairs(ColorableParts:GetChildren()) do
            ColorParts.Color = PlrColor
        end
    end

    plr:WaitForChild("PlayerColor"):GetPropertyChangedSignal("Value"):Connect(update)

    MPS.ProcessReceipt = function(receiptInfo)
        if receiptInfo.ProductId == DevProducts.ColorAllPalette then
            update()
        end
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
end)

Still Not Works, I dont know why, it should not work like this

Where does the script create the value?

Serverscript –

local Players = game.Players

Players.PlayerAdded:Connect(function(Player)
	local PlayerColor = Instance.new("Color3Value")
	PlayerColor.Name = "PlayerColor"
	PlayerColor.Parent = Player
end)

–local

local wheel = script.Parent:WaitForChild("ColorWheelImage")

local Players = game.Players

local Player = Players.LocalPlayer

wheel.ColorChanged.Event:Connect(function(NewColor)
	Player.PlayerColor.Value = NewColor
end)

You are changing the values, on local script, which is not replicated to server, it only changes for client.

1 Like

Oh, yea, I forgot about this, Thank You, Sir!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.