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

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

Asked by
slatvr 0
1 year ago
Edited 1 year 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 2 — 1y
0
I only want it to return true if it touches the puck. slatvr 0 — 1y
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 1777 — 1y

Answer this question