Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-3

Tween not working? 'Unable to cast double to UDim2

Asked by 3 years ago

Hello. This is not my main account but I have a question. I am currently trying to create a Gui kit but the Gui doesn't seem to work. I added a 'Tween' option so instead of the Gui increasing in size when MouseEnter has begun, it will tween to the respected size. I cannot find the bug as the 'Size' option works but the 'Tween' doesn't. Since I can't find the bug here's the raw code:

-- Variables local RunService = game:GetService("RunService") local Settings = script.Settings local ShowHitboxes = Settings.ShowHitboxes local Print = Settings.Print local Tween = Settings.Tween local Main = script.Parent.Parent.TextLabel local Button = script.Parent.Parent.TextLabel.TextLabel local Text = script.Parent.Parent.TextLabel.TextLabel.TextLabel local TextShadow = script.Parent.Parent.TextLabel.TextLabel.Shadow -- RunService:IsStudio(), RunService:IsServer() if ShowHitboxes.Value == true then if RunService:IsStudio() then script.Parent.Text = "HITBOX" if Print.Value == true then print("IsStudio() = true") end script.Parent.BackgroundTransparency = 0.8 end if RunService:IsServer() then script.Parent.Text = "" if Print.Value == true then print("IsServer() = true") end script.Parent.BackgroundTransparency = 1 end else script.Parent.BackgroundTransparency = 1 script.Parent.Text = "" if Print.Value == true then print("ShowHitboxes.Value = false") end end -- (gui).Text local TextValue = script.Text.Value Text.Text = TextValue TextShadow.Text = TextValue -- (gui).MouseEnter function Hover() if Tween.Value == false then Main.Size = UDim2.fromScale(Main.Size.X.Scale1.1,Main.Size.Y.Scale1.1) Button.Size = UDim2.fromScale(Button.Size.X.Scale1.05,Button.Size.Y.Scale1.05) Text.Size = UDim2.fromScale(Text.Size.X.Scale1.1,Text.Size.Y.Scale1.1) TextShadow.Size = UDim2.fromScale(TextShadow.Size.X.Scale1.1,TextShadow.Size.Y.Scale1.1) else Main:TweenSize(Main.Size.X.Scale1.1,Main.Size.Y.Scale1.1) Button:TweenSize(Button.Size.X.Scale1.1,Button.Size.Y.Scale1.1) Text:TweenSize(Text.Size.X.Scale1.1,Text.Size.Y.Scale1.1) TextShadow:TweenSize(TextShadow.Size.X.Scale1.1,TextShadow.Size.Y.Scale1.1) end script.Hover:Play() end -- (gui).MouseLeave function Leave() if Tween.Value == false then Main.Size = UDim2.fromScale(Main.Size.X.Scale0.9091,Main.Size.Y.Scale0.9091) Button.Size = UDim2.fromScale(Button.Size.X.Scale0.9524,Button.Size.Y.Scale0.9524) Text.Size = UDim2.fromScale(Text.Size.X.Scale0.9091,Text.Size.Y.Scale0.9091) TextShadow.Size = UDim2.fromScale(TextShadow.Size.X.Scale0.9091,TextShadow.Size.Y.Scale0.9091) else Main:TweenSize(Main.Size.X.Scale0.9524,Main.Size.Y.Scale0.9524) Button:TweenSize(Button.Size.X.Scale0.9524,Button.Size.Y.Scale0.9524) Text:TweenSize(Text.Size.X.Scale0.9524,Text.Size.Y.Scale0.9524) TextShadow:TweenSize(TextShadow.Size.X.Scale0.9524,TextShadow.Size.Y.Scale0.9524) end end function Click() script.Click:Play() end -- function:Connect() script.Parent.MouseEnter:Connect(Hover) script.Parent.MouseLeave:Connect(Leave) script.Parent.MouseButton1Down:Connect(Click)

Answer this question