Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Firing a remote located on all players in workspace?

Asked by 5 years ago

So, I am trying to make a script to fire off a remote event located inside of a player's character in workspace. The remote event is located inside of a weld object.

My goal is to write a script that checks to see if all players have the weld inside of their player in workspace, and if they do, I want to fire the remote event. Currently, with this code, when I test it in game, the only person the remote fires on is my player.

Here is the code below:

local plr = game.Players.LocalPlayer
local mou = plr:GetMouse()
local Players = game:GetService('Players')

mou.KeyDown:Connect(function(key)
    if key:lower() =='n' then
        print(1)
        local v = Players:GetPlayers()
        for i = 1, #v do
            local c = v[i].Character
            if c["ball.weld"] then
                c["ball.weld"].Part1.knockloose:FireServer()
            else
            break
            end
        end
    end
end)

Answer this question