✓ Accepted answer
you can use RemoteEvents with arguments for check, example:
local event = game.ReplicatedStorage.RemoteEvent
event.OnServerEvent:Connect(function(player,arg)
if arg == "CreatePart" then
local part = Instance.new("Part")
part.Parent = workspace
end
end)
local event = game.ReplicatedStorage.RemoteEvent
event:FireServer("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
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
event:FireServer("CreatePart")
Hope it helped
Wiki pages
Remote Events/Functions
3 comments
Use RemoteEvents
Use a ServerScript, why would you use a Local one?
I was creating a building script which uses a GUI to select parts and things like that