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

(Answered) How Do I Create Instances From A Local Script For The Entire Server To See?

Today I tried to create a local script that creates new instances in the workspace for the entire server but unfortunately I don't understand how to communicate after the filtering enabled update and I wasted somewhere in between an hour and a half to 2 hours trying to figure it out using remote functions and events until I scrapped everything except the local script in one of the starter gui's, Here it is:

script.Parent.MouseButton1Click:Connect(function()
	local MusicFolder = Instance.new("Folder", workspace)
	local SongId = Instance.new("NumberValue", workspace)
	local Username = Instance.new("StringValue", workspace)
	SongId.Value = script.Parent.Parent.TextBox.Text
	Username.Value = script.Parent.Parent.Parent.Parent.Parent.Name
	SongId.Parent = MusicFolder
	Username.Parent = MusicFolder
	SongId.Name = "SongId"
	Username.Name = "Username"
	MusicFolder.Parent = game.Workspace.MusicGenerator
end)

Could someone please show me how to make the folder and values spawn in the workspace for the entire server and not just for the client?

1 answer

✓ Accepted answer

To bypass filtering enabled, you'll have to use remote events, since the client's changes to the workspace do not replicated. I wasn't sure what the parents of your script were, so excuse the poor variable names in the remote event.

--Local script

local remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") --wait for remote

script.Parent.MouseButton1Click:Connect(function()
   remote:FireServer(script.Parent.Parent.Parent.Parent.Parent.Name,script.Parent.Parent.TextBox.Text) --send needed data
end)


--Server script

local RepStorage = game:GetService("ReplicatedStorage")
local remote = Instance.new("RemoteEvent") --create remote
remote.Parent = repStorage

remote.OnServerEvent:Connect(function(player,name,TextboxText)
    local MusicFolder = Instance.new("Folder") --second argument of .new() deprecated
    MusicFolder.Parent = workspace
    local SongId = Instance.new("NumberValue")
    SongId.Parent = workspace
    local Username = Instance.new("StringValue")
    Username.Parent = workspace
    SongId.Value = TextboxText
    Username.Value = name
    SongId.Parent = MusicFolder
    Username.Parent = MusicFolder
    SongId.Name = "SongId"
    Username.Name = "Username"
    MusicFolder.Parent = game.Workspace.MusicGenerator
end)

Resources:

Remote Events

Accept and upvote if this helps!

4 comments

0

@gioni01 Thank You So Much! (Sorry I Can't Up vote Your Answer, I Just Created My Scripting Helpers Account Today And I Need 25 Reputation)

1

its okay!

0

Now That I Have Enough Reputation I Up voted

1

lol thanks

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