I tried to pass information from the client to the server, but it didn't work. I tried remote events, bindable events, remote functions, bindable functions, but none of them worked. Can someone help me? here is my code for client: `mouse.KeyDown:Connect(function() game.ReplicatedStorage.RemoteEvent:FireServer(brickcolor.new("Really Red") server code: game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(color) workspace.Part.BrickColor = color
The KeyDown
function is deprecated, It's better to use UserInputService
instead
https://developer.roblox.com/en-us/api-reference/class/UserInputService
local UserInputService = game:GetService("UserInputService") UserInputService.InputBegan:Connect(function(key) if key.UserInputType == Enum.UserInputType.MouseButton1 then game.ReplicatedStorage.RemoteEvent:FireServer(BrickColor.new("Really Red")) end end)
then your server script:
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(color) workspace.Part.BrickColor = color end)