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

Remote function not being invoked?

Asked by
Nikkulaos 229 Moderation Voter
4 years ago
Edited 4 years ago

im trying to get this remove function to be invoked so the server can check if the player owns a specific character, but it wont invoke the function for some reason.

local script:

script.Parent.MouseButton1Down:Connect(function()
    print("!") -- this part prints
    local re = game.ReplicatedStorage.Etc.CharacterCheckServer:InvokeServer(script.Parent.Name)
    if re == true then
        script.Parent.Parent.Character.Text = "CHARACTER: "..script.Parent.Name
        script.Parent.Parent.Confirm:Play()
        game.ReplicatedStorage.Etc.CharacterChoseText:Fire(true,script.Parent.Name)
    else
        script.Parent.Parent.Deny:Play()
        game.ReplicatedStorage.Etc.CharacterChoseText:Fire(false,script.Parent.Name)
    end
end)

server script:

function game.ReplicatedStorage.Etc.CharacterCheckServer.OnServerInvoke(plr,chr)
    print("2") -- this part does not print?
    local bool
    if plr.Data:FindFirstChild(chr).Value == true then
        plr.Data.Character.Value = chr
        bool = true
    else
        bool = false
    end
    return bool
end

theres no errors i output either, so that helps a lot

i hope someone can help a dude out, thank you

Answer this question