I made a script that resizes a gui by a cars speed (magnitude) (dunno if it works) but it always gives me Players.ieatandisbaconhair.PlayerGui.ScreenGui.LocalScript:9: attempt to perform arithmetic on field 'Value' (a userdata value). The value does have something in it.
Cloning the gui script:
script.Parent.ChildAdded:Connect(function(child)
if child:IsA("Weld") then
local plr = game.Players:GetPlayerFromCharacter(child.Part1.Parent)
local e = script.ScreenGui:Clone()
e.Parent = plr:WaitForChild("PlayerGui")
e.Car.Value = script.Parent.Parent
end
end)
the script inside the gui:
local gui = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("ScreenGui")
script.Parent.Car.Value.VehicleSeat.ChildRemoved:Connect(function(child)
if child:IsA("Weld") then
script.Parent:Destroy()
end
end)
gui.bar:TweenSize(UDim2.new(script.Parent.Car.Value.VehicleSeat.Velocity.Magnitude/script.Parent.Car.Value.Value,0,1,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quint,.5,true)
ty

9 comments
Did you keep the default name of a value object if so then you need Value.Value
no, its called car
Which type of value is Car?
I believe that script.Parent.Car.Value.Value isn’t a value, it’s an instance.
Car is an ObjectValue?
I'm sorry but that name makes it hard for us to take you seriously and what about your own convenience, what's with that huge name and formatted poorly. I'm referring to "ieatandisbaconhair" in case you didn't catch on.
Is "Value" a descendant of the Car's Value? Look at the 2nd part of line 9, that's what's giving you trouble. "script.Parent.Car.Value.Value" That's not correct
it actually is supposed to be car.Value.Value. Because, in the car, i have a value called Value.
nvm fixed it lol