How to combine 2 scripts into 1?

I’ll click on the solution and go to rest, I’ve wasted a lot of time

1 Like

In the demonstration it does this. Let me try publishing it and allowing share access and see if that fixes it. I will delete the post where it doesn’t let you open it

1 Like

Loop Kill All(A deluxor module script demonstration).rbxl (53.4 KB)

This should significantly help you understand exactly how to achieve what you are trying to achieve with combining two scripts into one. Module scripts allow you to do this by connecting two scripts. They just didn’t help you understand exactly what you need to do which is necessary for you to know how to design your own module script.

It should let you open the place now without any issues.

It didn’t help me and it sounds strange, I still need help, help

What? How does it sound strange… it’s a great demonstration of how module scripts work.

Why would you need to combine them? also you should use loops instead of distance1, distance2, ect… this will make your script shorter and easier

Making multiple scripts to do something is OK, as long as you don’t repeat yourself when working on actual game, not some animation or one time use tool, simply make that one script is one function, then you’ll be fine

1 Like

Of course this website just failed miserably and flagged the wrong post! Wonderful. I was flagging the other one and it glitched out and flagged yours. I’m so sorry

1 Like

You know I wouldn’t do something like that especially after I talked with you before in messages and you were there to help me. I don’t know why that just happened but I’m really disgusted right now. Next time if I see people typing I will wait until they finish before doing that because it just failed me miserably

1 Like

It’s all okay homie, no need to worry about it

1 Like

Well, look, I have 20 parts and I have to write this script in each part, although it would be possible to connect them and that’s it, right?

you should use loop and have script in script service, then you need only 1 script

Why server script service? I have a large script located startercharacterscript

It’s safer and more usefull, getting player’s character is matter of adding 5 more lines of code

EDIT: Grammar

1 Like

Can you write an example so that I understand what you mean, what do you mean in the server script service?

Uhh, for example this is how to make 1 script for all of 20 parts

local Parts = workspace.Parts:GetChildren()

for i, part in Parts do
    local connection
    connection = part.Touched:Connect(function()
        -- some code 
        connection:Disconnect() -- in this case i want to play event only once and then stop listening
    end
end

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.