So I made these Boots that have a neon line on them indicating that the boots are on and if they’re off then the line transparency is 1 but it only changes transparency on the client screen and not for other players. I am still learning to script so I don’t know much about remote events. I know I have to use a remote event. How can I do it? This is my local script in starterCharacterScript:
local userInputService = game:GetService("UserInputService")
local LBoot = script.Parent:WaitForChild("LeftBoot")
local RBoot = script.Parent:WaitForChild("RightBoot")
local LTransparency = LBoot.Neon.Transparency
local RTransparency = RBoot.Neon.Transparency
userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.B then
if LBoot.Neon.Transparency == 0 and RBoot.Neon.Transparency == 0 then
LBoot.Neon.Transparency = 1
RBoot.Neon.Transparency = 1
game.Players.LocalPlayer.Backpack.Dash.Disabled = true
LBoot.Bottom.Trail.Enabled = false
RBoot.Bottom.Trail.Enabled = false
script.BeepOff:Play()
print("BootOff")
else if LBoot.Neon.Transparency == 1 and LBoot.Neon.Transparency == 1 then
LBoot.Neon.Transparency = 0
RBoot.Neon.Transparency = 0
game.Players.LocalPlayer.Backpack.Dash.Disabled = false
LBoot.Bottom.Trail.Enabled = true
RBoot.Bottom.Trail.Enabled = true
script.BeepOn:Play()
print("Boot On")
end
end
end
end
end)
Yes, You would make a Remote Event with Arguments (The parts you want to change), Fire the event in the local script. And then Connect it with a function on a serverside script that changes the parts.
local RemoteEvent = game.ReplicatedStorage.remotes.Boots
local userInputService = game:GetService("UserInputService")
userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.B then
RemoteEvent:FireServer()
end
end
end)
Server:
local RemoteEvent = game.ReplicatedStorage.remotes.Boots
local LBoot = script.Parent:WaitForChild("LeftBoot")
local RBoot = script.Parent:WaitForChild("RightBoot")
local LTransparency = LBoot.Neon.Transparency
local RTransparency = RBoot.Neon.Transparency
RemoteEvent.OnServerEvent:Connect(function(player,str)
print(player.Name,str)
if LBoot.Neon.Transparency == 0 and RBoot.Neon.Transparency == 0 then
LBoot.Neon.Transparency = 1
RBoot.Neon.Transparency = 1
game.Players.LocalPlayer.Backpack.Dash.Disabled = true
LBoot.Bottom.Trail.Enabled = false
RBoot.Bottom.Trail.Enabled = false
script.BeepOff:Play()
print("BootOff")
else if LBoot.Neon.Transparency == 1 and LBoot.Neon.Transparency == 1 then
LBoot.Neon.Transparency = 0
RBoot.Neon.Transparency = 0
game.Players.LocalPlayer.Backpack.Dash.Disabled = false
LBoot.Bottom.Trail.Enabled = true
RBoot.Bottom.Trail.Enabled = true
script.BeepOn:Play()
print("Boot On")
end
end
end)
But it doesn’t print any errors or change the transparency even for the client.
It didnt work. But I Added a print statement on the Client script to print fired when the player clicks B but it prints but doesnt fire:
local RemoteEvent = game.ReplicatedStorage.remotes.Boots
local userInputService = game:GetService("UserInputService")
userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.B then
RemoteEvent:FireServer()
print("Fired")
end
end
end
)