how would I do that, I have 2 blocks, I want so that if I press a key, the 1st block disappears and the second one appears
disappear = no cancolide and 1 transparent
You’d probably want to use UserInputService, and a RemoteEvent telling the server to make the parts visible
This would be in the local script
local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEventName
local key = "E" --You can change this to whatever you want
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode[key] then
RemoteEvent:FireServer()
end
end)
This would be in a server script
local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEventName.OnServerEvent:Connect(function(player)
workspace.Part.Transparency = 1
workspace.Part.CanCollide = false
workspace.Part2.Transparency = 0
workspace.Part2.CanCollide = true
end)
2 Likes