Hello, EmorchThe_Robloxian! The easiest way to do this is to use a remote event. To do this, do the following
Setup
- Create a remote event in ReplicatedStorage
- Name the Event "KeyPressed"
- Create a script in ServerScriptService
- Name the script "Receiver"
- Make a local script in StarterPlayerScripts
- Name the script "Listener"
Script Making
Receiver Script:
event = game:GetService("ReplicatedStorage"):WaitForChild("KeyPressed")
part = INSTANCE of part to make appear
event.onServerEvent:Connect(function(_)
part.Transparency = 0
end)
Listener Local Script:
event = game:GetService("ReplicatedStorage"):WaitForChild("KeyPressed")
UIP = game:GetService("UserImputService")
UIP.ImputBegan:Connect(function(imput, typing)
if typing == true then return end
if imput.KeyCode == Enum.KeyCode.R then
event:FireServer()
end
end)
Script Context
Above, you see a basic example of client-server communication with a remote event. This is a rundown of how it works. The client, or your computer, will detect when a button on your keyboard is pressed and if it is "R". If it is, it will fire something called a Remote Event. This "Remote Event", will take information from our client(You computer), and send it to the server (the game). In our case, once the server is fired, (Fired is a term used to represent a event being called/activated), it will make the part visible. Now, you may ask why not just make it visible on the client. The answer is because if you make it visible on the client, you will see it, but the server wont. This means that everyone else wont be able to see the brick, but you will.
With any further questions/comments/concerns, please comment or create a new question! ~mc3334
1 comment
I got an idea. Put the brick in replicated storage instead of the script.Then say game:GetService("ReplicatedStorage"):FindFirstChild("Brick"):Clone() And then do Brick.Parent = game.Workspace. And what is the problem here, like what exactly? What does the output say?