The question is really simple, Is there any way to create a global part with a local script?
This localscript creates a local part:
local part = Instance.new("Part") part.Parent = workspace
But how do i make it so that the script instead creates a global part?
you can use RemoteEvents with arguments for check, example:
-- Server local event = game.ReplicatedStorage.RemoteEvent -- RemoteEvent location event.OnServerEvent:Connect(function(player,arg) -- the first parameter is player, second parameter is argument. if arg == "CreatePart" then -- If argument equal to CreatePart -- Create part script local part = Instance.new("Part") part.Parent = workspace end end)
-- Client local event = game.ReplicatedStorage.RemoteEvent -- RemoteEvent location event:FireServer("CreatePart") -- here you dont need to send player, only argument. i send argument "CreatePart"
For your script use this:
Create a RemoteEvent in ReplicatedStorage, now Create a Script(ServerScript/Regular Script) in ServerScriptService and put this code:
local event = game.ReplicatedStorage.RemoteEvent -- RemoteEvent location event.OnServerEvent:Connect(function(player,argument) if argument == "CreatePart" then local part = Instance.new("Part") part.Parent = workspace end end)
Now on your LocalScript put this:
local event = game.ReplicatedStorage.RemoteEvent -- RemoteEvent location -- Your functions... event:FireServer("CreatePart")
Hope it helped