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

Why does this increase part size code crash roblox studio?

Asked by 3 years ago

So 'dong' is a part, and I'm trying to have the player increase the Y size of it by stepping on another part which is 'increase size button'. When I go into play mode and step on increase size button, studio instantly freezes and crashes eventually. For the output it just says 'Y cannot be assigned to'...

Code: https://gyazo.com/a2c1fdd5020d5f9f1f6b8dfef2c00e91 Output: https://gyazo.com/f23a94899e7f934fd226a8f40afeb436

1 answer

Log in to vote
0
Answered by
crueluu 169
3 years ago
Edited 3 years ago

There is A Much Better Way To Do This, Roblox Has These Services Called "Tween Service" And What They Do is, They Tween The Objects That You Want To Transform/Move Here I'll Write The Code And Make It Easier For You.. Note:Make sure this script is in "increase size button" or it wont work. Script:

local dong = game.Workspace.dong
           local tweenservice = game:GetService("TweenService")-- get the tweenservice first
local info = TweenInfo.new(
  4,-- the duration of "dong" Size Changing  
  Enum.EasingStyle.Sine, --The Style You Want To Make dong Change in
  Enum.EasingDirection.Out,-- The Direction Which Should Be "Out" In Your case
  0,--these arent really relevant to your Case
  false,--
  0--------------------------------------------------)
  )
local goals = {--now we're gonna tell the script How Big/Small We Want "dong" To Be
Size = Vector3.new(dong.Size.X,20,dong.Size.Z)--you can replace the 20 with how high you want "dong" to be after The Tranformation!

} 
local tween = tweenservice:Create(dong,info,goals)--now lets create the whole tween with everything we have written!
script.Parent.Touched:Connect(function()-- now for the most important part!!!
    tween:Play()


end)

If you Have Anymore Questions Then Im Happy T Answer :)

0
Thanks for the reply, but do you know why my script is freezing studio by any chance, and/or why it isn't increasing the size properly? JGBlocky 9 — 3y
0
Nope Sadly My Studio Didnt Lag When That Error Was OutPuted, So I Don't Really Know Much Soz :( crueluu 169 — 3y
0
Its Probably Because Executing A Script like That Would Possibly Crash R.S or Maybe Your PC Is Weak tbh idk. crueluu 169 — 3y
0
Besides I Think Its Much More Smoother To use The Tween Service crueluu 169 — 3y
View all comments (4 more)
0
Ah ok... did the script work for you, like did it increase the size as it should have done? JGBlocky 9 — 3y
0
Yes And In A Smooth Way Too! crueluu 169 — 3y
0
Ah nice! Did my bad script work though? JGBlocky 9 — 3y
0
I Dont know did it? you said it crashed roblox studio. crueluu 169 — 3y
Ad

Answer this question