Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would i make multiple blocks work as a spleef?

So basicly i have a model called level1 and what i am looking is to add a spleef script in them which i have in the workspace called spleefscript! What im looking to do is insert or make all of those 200 blocks work on that single script and not make me put a script in each of the blocks that might that 2 hours.

3 comments

0

There is a really easy way to put the script in each of the parts very quick. But yeah you should really not do that. But this is not a request site, why don't you give it a try to make the code first?

0

If you run in to some problem you can ask here, or on Discord, either in the SH server or dm me. But promise you'll try first

0

No i am asking is it possible to make a script that acts globally to each part in a model?

1 answer

✓ Accepted answer

You can use one script to interact with multiple objects in your game. But of course, you will need to reference them.

You may not be able to implement this into your script, but it is because I have no idea what your script looks like.

In this example here I used a for loop to get (or reference I think) the blocks that are the platform for a Spleef game.

-- Let's just say that you put all of the blocks used as the platform 
-- in a Spleef game in a folder
-- named SpleefPlatform.

-- remember to define speelfPlatform folder correctly since I did not, this will give an error if you don't.
local spleefPlatform

local function activateSpleefPlatform()
    for _, child in pairs(spleefPlatform:GetChildren()) do

        if not child:IsA("BasePart") then return end
        local spleefPlatformBlock = child
    	
		-- there is a high chance that you will use a .Touched event.

        spleefPlatformBlock.Touched:Connect(function(partHit)
            -- Make them disappear if a player touches or something...
        end)
    end
end

activateSpleefPlatform()

For more information about for loops, go to this link: https://developer.roblox.com/en-us/articles/Loops

This discussion is preserved as it was. New answers, comments, and votes are closed.