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?
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)
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)