I’m currently working on my module script used to simplify code.
Module here: SimpleZ's Simple Commands - Roblox
I need help thinking of scripts that might be complicated that could be simplified as a function.
The script already contains:
Functions
Interpolate (Tween Service) Ray-cast (Visualized or Hidden)
Animate Kick
Move Rotate
Forward Move Point Towards
Teleport Place (Takes a player) Teleport Block (Takes a player character)
Prompt User (Only supports up to 4 types :/)
What are some scripts that should be simplified?
An example of a function (Interpolate):
Sorry if code is pasted weirdly. Copy and paste problems!
1. function SimpleZ.Interpolate(Obj, Time, Goals, EasingStyle, Direction, RepeatAmount, reverse, delaytime)
2.
3. local Success, Error = pcall(function()
4. TweenService:Create(Obj,TweenInfo.new(Time, EasingStyle, Direction, RepeatAmount, reverse, delaytime),Goals):Play()
5. end)
6. if Success then
7. print(script.Name .. " - Interpolated " .. tostring(Obj) .. " in " .. tostring(Time) .. " seconds with goals: " .. tostring(Goals))
8. else
9. print(script.Name .. " - Couldn't Interpolate " .. tostring(Obj) .. " in " .. tostring(Time) .. " seconds! ERROR!")
10. warn(Error)
11. end
12.
13. end
I don’t know if this is where the topic belongs. I’ll just wait and see if this gets taken down.
Your in the right topic. Run the code a few times with part that seem unnecessary. That might be able to make the script smaller and more understandable.
There’s no need for this, just making a tween will not cause any error unless you do it wrong, you don’t need a function to tween objects with tweenservice
it’s like doing a function/module to print
Also you could reduce it to this
local suc,tween = pcall(game:GetService('TweenService').Create,game:GetService('TweenService'),workspace.Part,TweenInfo.new(1),{Position = workspace.Part.Position + Vector3.new(0,6,0)}) if (suc) then tween:Play() end