#RemoteEvent won't fire

15 messages · Page 1 of 1 (latest)

raven nicheBOT
#

studio** You are now Level 3! **studio

solar hedge
#

its all because of this

lunar peak
#

are you making some kind of blade ball knockoff game

#

js asking

#

lel

solar hedge
#
task.spawn(function()
    while true do
        local closestPlayer = nil
        local closestDistance = math.huge

        for _, player in ipairs(game.Players:GetPlayers()) do
            local character = player.Character
            if character and character:FindFirstChild("HumanoidRootPart") then
                local distance = (character.HumanoidRootPart.Position - ballPosition).Magnitude
                if distance < closestDistance then
                    closestPlayer = player
                    closestDistance = distance
                end
            end
        end

        if closestPlayer then
            local velocity = (closestPlayer.Character.HumanoidRootPart.Position - ballPosition).Unit * speed
            ball.Velocity = velocity
        end

        ballPosition = ball.Position
        wait(0.1)
    end
end)

blockEvent.OnServerEvent:Connect(function(player)
    print(player.Name .. " has triggered the 'Block' event on the server!")
end)```
lunar peak
#

interesting concept ig

#

wtf is task.spawn

#

since when did that exist

#

wat

solar hedge
lunar peak
#

crazy

solar hedge
#

but task was not used that much

#

so what does it print in output

#
local player = game.Players.LocalPlayer
local UserInputService = game:GetService("UserInputService")
local BlockEvent = game.ReplicatedStorage.Events.Block

local function onInputBegan(input, gameProcessed)
    if input.UserInputType == Enum.UserInputType.MouseButton1 and not gameProcessed then
        print("Mouse button 1 clicked")
        BlockEvent:FireServer()
        print(BlockEvent,'Firing to Server')
    end
end

UserInputService.InputBegan:Connect(onInputBegan)```