I try Creating Part From Module Script but its not work

  1. **What do you want to achieve?**If Player Click then
    Part.Position = Player
    And If TypePart == “Smolle” then
    Past.Size = Vector3.new(1,1,1)
    {My Model Script In ServerScriptServise, And Normal Script to}
  2. What is the issue? Module Script
local module = {}

 function CreatingPart(Player: Player, TypePart: "Smolle" | "Medium" | "Big")
		local Part =	Instance.new("Part", workspace)
		Part.Position = Player
		if TypePart == "Smolle" then
			Part.Size = Vector3.new(1,1,1)
		elseif TypePart == "Medium" then
			Part.Size = Vector3.new(3,3,3)
		elseif TypePart == "Big" then
			Part.Size = Vector3.new(6,6,6)
		end
	end


return module

Normal Script

local ServerScriptService = game:GetService("ServerScriptService")

local Click = workspace.Click

local ModuleScript = require(ServerScriptService.ModuleScript)

Click.ClickDetector.MouseClick:Connect(function(Player)
	ModuleScript.CreatingPart(Player, "Smolle")
end)


  1. What solutions have you tried so far? I try see in youtobe But its problem not see in youtobe
1 Like

You have to have the CreatingPart function be a part of the module table, so that it can be accessed by the requiring script:

local module = {}

module.CreatingPart = function(Player: Player, TypePart: "Smolle" | "Medium" | "Big")
		local Part =	Instance.new("Part", workspace)
		Part.Position = Player
		if TypePart == "Smolle" then
			Part.Size = Vector3.new(1,1,1)
		elseif TypePart == "Medium" then
			Part.Size = Vector3.new(3,3,3)
		elseif TypePart == "Big" then
			Part.Size = Vector3.new(6,6,6)
		end
	end


return module

Problem22

I dont no why its Call Nil
{OOps Am sor its not “9” its “8”}

Can you please send the script that is erroring? Currently, Line 9 of Script is shown as just end)

In Normal Script Hare

local ServerScriptService = game:GetService("ServerScriptService")

local Click = workspace.Click

local ModuleScript = require(ServerScriptService.ModuleScript)

Click.ClickDetector.MouseClick:Connect(function(Player)
	ModuleScript.CreatingMap(Player, "Smolle")
end)

If you open the Normal Script, then press Alt+F, can you please sceenshot what it says there?

Screenshot_29

its Not Normal Why in close “Big” we have Player??

Oh I see why now.
In the module script, it is called CreatingPart, but in the server script it is called CreatingMap.
Change the server script line from

ModuleScript.CreatingMap(Player, "Smolle")

to

ModuleScript.CreatingPart(Player, "Smolle")

and it should work

Another Problem …

Part.Position = Player

Problem in module script

@PoppyandNeivaarecute thx for help me)

Replace

Part.Position = Player

with

Part.Position = Player.Character.HumanoidRootPart.Position
1 Like

What the mean “HumanoidRootPart” can you gave me link to documents in roblox or you can explain pls…

HumanoidRootPart is basically just the Torso of the player, but is invisible. It is always going to exist no matter the type of player rig

1 Like

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