Ad
Log in to vote
0

Can anyone explain why my RemoteFunction won't return true?

Asked by
slatvr 0
21 days ago
Edited 21 days ago
local PokeEvent = game.ReplicatedStorage.PuckPokeEvent

function PokeEvent.OnServerInvoke(Player, StickPart, Torso, StickTool)
    print('event')
    local Debounce = false;
    StickPart.Touched:Connect(function(Touch)
        if Touch.Name == 'Puck' and Debounce == false then
            print('hi')
            Debounce = true
            local Motor6d = Instance.new('Motor6D')
            Touch.Parent = StickTool
            Motor6d.Parent = Torso
            Motor6d.Part0 = Torso
            Motor6d.Part1 = Touch
            Motor6d.Name = 'Puck'
            return true
        end
    end)
    task.wait(1)
    Debounce = true
    return false
end
0
did you try adding " return true" at the very end? Cubispaghettis 1 — 21d
0
I only want it to return true if it touches the puck. slatvr 0 — 21d
0
You are not returning back to the remote function. 'return true' is inside the Touched event which will return back to the touched event rather than the remote function. xInfinityBear 1691 — 21d

Answer this question