Basically I don’t get why I have to send this little piece of info on the client and it passes but on the server it doesn’t pass, why is this?
Tool = script.Parent
RemoteEvent = Tool:WaitForChild("RemoteEvent")
UserInputService = game:GetService("UserInputService")
LightingService = game:GetService("Lighting")
script.Parent.Equipped:Connect(function()
UserInputService.InputBegan:Connect(function()
RemoteEvent.OnServerEvent:Connect(function(Player, UserInput)
if UserInput.KeyCode == Enum.KeyCode.E then
-- LightingService.ClockTime = 6.5, this info didnt pass on server
end
end)
end)
end)
Tool = script.Parent
RemoteEvent = Tool:WaitForChild("RemoteEvent")
UserInputService = game:GetService("UserInputService")
LightingService = game:GetService("Lighting")
PlayerService = game:GetService("Players")
Tool.Equipped:Connect(function()
UserInputService.InputBegan:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.E then
RemoteEvent:FireServer(Input)
LightingService.ClockTime = 6.5 -- this info passes
print("Key Has Been Pressed")
end
end)
end)
local UserInputService = game:GetService("UserInputService")
local Tool = script.Parent
local RemoteEvent = Tool:WaitForChild("RemoteEvent")
RemoteEvent.OnServerEvent:Connect(function(Player, Input)
if Tool.Equipped and UserInputService.InputBegan then
if Input.KeyCode == Enum.KeyCode.E then
print("It works!")
end
end)
end)
uhh actually, it does work, but my question was, why when i try to send the info to the server it doenst work but when i send it to the client it works?
It was most likely the way the lines were structured.
Line structuring is important because scripts execute line by line and it wouldn’t have worked the way it was structured before. Glad to know this worked.