Hello scripters that are better than me, I am trying to make a script where if the temperature value reaches a certain amount, coresize value increases until it reaches 20. The coresize value should increase the size of a part. Here is what I tried:
temperature = 200 coresize = 4 if true then wait(3) temperature = temperature +5 end if temperature >= 210 then coresize = coresize + 1 script.Parent.Size.X = coresize script.Parent.Size.Y = coresize script.Parent.Size.Z = coresize repeat until coresize == 20 end
Any help is much appreciated =)
temperature = 200 maxtemperature = 210 coresize = 4 while wait(3) do temperature = temperature +5 if temperature >= maxtemperature then script.Disabled = true repeat coresize = coresize + 1 script.Parent.Size.X = coresize script.Parent.Size.Y = coresize script.Parent.Size.Z = coresize until coresize == 20 end end
Though I understand your question, your attempt at solving it very much confused me, so I will show you an example of how I would do it and explain as I go. The code below assumes that the script is within a part inside the Workspace.
--We create our values as instances, unlike your variables above local temperature = Instance.new("IntValue") temperature.Parent = script.Parent temperature.Value = 200 temperature.Name = "temperature" local coresize = Instance.new("IntValue") coresize.Parent = script.Parent coresize.Value = 4 coresize.Name = "coresize" local TempBeforeChange = 201 --The value that will trigger the event temperature.Changed:Connect(function(prop) --Fires when the value changes if temperature.Value >= TempBeforeChange then for i = coresize.Value,20 do --Loop from coresize to 20 wait() coresize.Value = i script.Parent.Size = Vector3.new(coresize.Value,coresize.Value,coresize.Value) end end end)
You can change this at your own desire, as it was just an example!