local RemoteEvent = Instance.new("RemoteEvent", script.Parent)
RemoteEvent.Name = "Transparency"
RemoteEvent.OnServerEvent:Connect(function(player, part)
if part.Parent == workspace then
if part.Locked == false then
if part.Transparency == 1 then
part.Transparency = 0
else
part.Transparency = part.Transparency + 0.1
end
end
end
end)
I’m making BTools for my game, however this transparency script doesn’t check if transparency is already 1 and just keeps raising it.
I feel like I’ve heard recently that the engine is having floating point errors sometimes, perhaps this is an example of it. Instead of transparency == 1, try >=
Unless you’re also doing this for Lua 5.3 (or vanilla Lua), you could do, to save typing
part.Transparency += 0.1
You can do
not part.Locked
To add to that, Lua 5.1 numbers cannot represent values over 2 ^ 53 safely, also float is ambiguous, it can refer to single (32-bit) or double (64-bit), Lua 5.1 uses double.
For more information see: https://0.30000000000000004.com/