I don't get any error code, but yet i seem to get a completely random output, here's my scripts;
Local Script Inside of Tool
script.Parent.Equipped:Connect(function()
loop = true
end)
script.Parent.Unequipped:Connect(function()
loop = false
end)
while wait(.1) do
if loop == true then
game.ReplicatedStorage.RemoteEvent:FireServer("ColorSword", 0)
end
end
Script Inside ServerScriptService
local event = game:GetService("ReplicatedStorage").RemoteEvent
event.OnServerEvent:Connect(function(plr, event, value)
if plr.Character:FindFirstChildOfClass("Tool") then
x = 255
y = 255
z = 255
if plr.leaderstats.Rep.Value > 0 then
if plr.leaderstats.Rep.Value <= 100 then
x = 255
y = 255
z = math.floor(255 / 100 * plr.leaderstats.Rep.Value)
else
x = 255
y = 255
z = 0
end
elseif plr.leaderstats.Rep.Value < 0 then
if plr.leaderstats.Rep.Value >= -100 then
x = 255
y = math.floor(255 / 100 * (plr.leaderstats.Rep.Value * -1))
z = math.floor(255 / 100 * (plr.leaderstats.Rep.Value * -1))
else
x = 255
y = 0
z = 0
end
else
x = 255
y = 255
z = 255
end
end
print(x.." "..y.." "..z)
plr.Character.ClassicSword.SwordColor.Value = Color3.new(x,y,z)
end)
Script Inside of Tool
while wait() do
script.Parent.Handle.Color = script.Parent.SwordColor.Value
end
It might look a bit messy, but that's because I've tried mettling a bit around with it, It's supposed to change the color of a tool depending on a players leaderstat value, so -1 would be slightly red, and -100 or less would be completely red, positive numbers would result in Yellow, Please help me, and thank you.
EDIT: I decided to show what I meant with "random output" So my "Rep" stat is -50 the expected Color3 would be "255,127,127" And I get "65025, 32385, 32385" Im so confused, Please help!

6 comments
Color3.fromRGB(0
255,0255,0~255)Color3.new(0
1,01,0~1)So, you use Color3.fromRGB.
Oh
Thank you!
You're welcome.