Ok so I was trying to use a RemoteFunction and this is my Client Script
local ReplicatedStorage = game:GetService("ReplicatedStorage") local QuakeF = game.ReplicatedStorage.QuakeF local QuakeForce = ReplicatedStorage.BodyForce script.Parent.MouseButton1Click:Connect(function() QuakeF:InvokeServer() end)
And this is my Server Script
local ReplicatedStorage = game:GetService("ReplicatedStorage") local QuakeF = game.ReplicatedStorage.QuakeF QuakeF.OnServerInvoke = function(player) print("do something please") for i,v in pairs(game.Workspace) do if v.Humanoid then v.Humanoid.Sit = true print("please do something") end end end
But i got this error message that says " 13:15:15.834 ServerScriptService.EarthquakeScript:6: invalid argument #1 to 'pairs' (table expected, got Instance) - Client - QuakeMove:9"
can anyone help me?
You Forgot To Use Get Children On You For Loop
Server Script
local ReplicatedStorage = game:GetService("ReplicatedStorage") local QuakeF = game.ReplicatedStorage.QuakeF QuakeF.OnServerInvoke = function(player) print("do something please") for i,v in pairs(game.Workspace:GetChildren()) do if v:FindFirstChild("Humanoid") then v.Humanoid.Sit = true print("please do something") end end end