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

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

Asked by 6 years ago
Edited 6 years ago

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:

01script.Parent.MouseButton1Click:Connect(function()
02    local MusicFolder = Instance.new("Folder", workspace)
03    local SongId = Instance.new("NumberValue", workspace)
04    local Username = Instance.new("StringValue", workspace)
05    SongId.Value = script.Parent.Parent.TextBox.Text
06    Username.Value = script.Parent.Parent.Parent.Parent.Parent.Name
07    SongId.Parent = MusicFolder
08    Username.Parent = MusicFolder
09    SongId.Name = "SongId"
10    Username.Name = "Username"
11    MusicFolder.Parent = game.Workspace.MusicGenerator
12end)

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

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

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.

01--Local script
02 
03local remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent") --wait for remote
04 
05script.Parent.MouseButton1Click:Connect(function()
06   remote:FireServer(script.Parent.Parent.Parent.Parent.Parent.Name,script.Parent.Parent.TextBox.Text) --send needed data
07end)
08 
09 
10--Server script
11 
12local RepStorage = game:GetService("ReplicatedStorage")
13local remote = Instance.new("RemoteEvent") --create remote
14remote.Parent = repStorage
15 
View all 30 lines...

Resources:

Remote Events

Accept and upvote if this helps!

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) kizi3000 88 — 6y
1
its okay! Gey4Jesus69 2705 — 6y
0
Now That I Have Enough Reputation I Up voted kizi3000 88 — 6y
1
lol thanks Gey4Jesus69 2705 — 6y
Ad

Answer this question