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

need help requiring a modulescript?

Asked by 3 years ago
Edited 3 years ago

Hello,

This is driving me nuts so I had to post. I've been trying to learn how to require scripts you make.

So far I've come up with this:

1) I've made a ModuleScript and renamed it to MainModule

2) I've added

local module = {}

function module.bring()

    Instance.new("Part", game.Workspace)

end
return module

4) I hit "Allow copying" and saved it to Roblox

5) I went into a game and did

 require(assetID).bring()

Now the problem I'm having is that it appears the require doesn't do anything. I've tested it with other assetIDs and it works fine, so I'm guessing it has something to do with my code

Any help is appreciated,

cheers

1 answer

Log in to vote
0
Answered by
jundell 106
3 years ago

You don't change it's CFrame so it spawns at 0, 0, 0.

local module = {}

function module.bring(position)
    Instance.new("Part", workspace).Position = position
end

return module

then do this:

local position = -- a position of your humanoidrootpart or something to make sure you see the part
require(assetID).bring(position)
0
where exactly am I supposed to put local position = (something)? IwontuserealnamexD 2 — 3y
0
The local position = [BLANK] is a variable. You put a Vector3 value in for it, as that will be where the brick is when it is made. NinjaMandalorian 252 — 3y
Ad

Answer this question