local valuelogger = Instance.new("RemoteEvent",game:GetService("ReplicatedStorage"))
valuelogger.Name = "requester"
local yourbutton = yourbuttonhere
yourbutton.MouseButton1Down:Connect(function()
valuelogger:FireAllClients("getlocalgravity")
end)
local commands = {
["gravityvalue"] =
function(player,...)
local args = {...} local gravity = args[1]
if typeof(gravity) ~= "number" then
player:Kick("invalid arguments") print(player.Name .. " gave invalid arguments for the gravity get command")
else
print("gravity for "..player.Name..": "..tostring(gravity))
end
end,
}
valuelogger.OnServerEvent:Connect(function(plr,...)
local args = {...}
local commandrecieved = false
for i,v in pairs(commands) do
if args[1] == i then
table.remove(args,1)
commandrecieved = true
v(plr,args)
end
end
if commandrecieved == false then plr:Kick("invalid remote arguments") end
end)
local requesterremote = game:GetService("ReplicatedStorage"):WaitForChild("requester")
local funcs = {
["getlocalgravity"] = function() requesterremote:FireServer("gravityvalue",workspace.Gravity) end,
}
requesterremote.OnClientEvent:Connect(function(request)
for i,v in pairs(funcs) do if request == i then v() end end
end)
i know this is not entirely secure but it will print every player's local gravity value from the client on the server
reply to me if there are any errors or incorrect kicks
10 comments
Where it says 'We will need to make some of this stuff' what exactly is it that I need to make?
folder in rep storage called 'Events' and remote function in the folder called 'GetGravity'
if you are testing it, make it loop every 5 seconds instead of 100
It doesn't work...
whats the error?
There's no error. Nothing happens at all.
did u wait 2 mins? cause it runs every 100 secs unless you shortened it
I shortened it to 5 seconds, but it still doesn't work.
put a print before the loop, right after the while wait(5), after the invoke client, and before return workspace.gravity in local script, which ones print?
Nvm, I got it to work.