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

Im getting (The function InvokeClient is not a member of "Player") in output?

Asked by 5 years ago
Edited by TheeDeathCaster 5 years ago

I tried having the client side reading a server side number value in the player but dosnt read the value right:

Client-Side:

local Values = game.ReplicatedStorage:WaitForChild("RemoteFunction")

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    if script.Parent.Parent.Player.Value == "" then
        script.Parent.Parent.Player.Value = player.Name
    end
    if player.Name == script.Parent.Parent.Player.Value then
        print("jwilenqgnblqnbw")
        local equiped = Values.InvokeClient(player)
        print(equiped) --Prints the value (Supposed to be 1 but prints 0)
        player.Character.Humanoid:EquipTool(player.Backpack:FindFirstChild(equiped))
        wait(0.150)
        if equiped == "lvl1" then
            script.Parent.Parent.Hits.BillboardGui.Damage.Text = script.Parent.Parent.Hits.BillboardGui.Damage.Text - 5
        end
        script.Parent.Chop1:Play()
        script.Parent.Parent.Particles.ParticleEmitter.Enabled = true
        wait(0.2)
        script.Parent.Parent.Particles.ParticleEmitter.Enabled = false
        wait(0.2)
        local axe = player.Character:WaitForChild(equiped):Clone()
        axe.Parent = player.Backpack
        player.Character:FindFirstChild(equiped):Destroy()
    end
    print(script.Parent.Parent.Hits.BillboardGui.Damage.Text)
    if script.Parent.Parent.Hits.BillboardGui.Damage.Text == "0" then
        script.Parent.Parent.PrimaryPart = nil
        print("Event fire attempt")
        game.ReplicatedStorage.Logg:FireClient(player)
        wait(5)
        print("Destroying")
        game.ReplicatedStorage.RemoteEvent:FireAllClients(script.Parent.Parent)
    end
end)

Server-Side localscript in playerstarterscriptps:

local function invoke()
    return script.Parent.Parent.AxeLvl.Value
end

game.ReplicatedStorage.RemoteFunction.OnClientInvoke = invoke

0
I'm a bit confused here, you are saying that the top script is the client side, yet you use FireAllClients on it, which is a function exclusive to the server theking48989987 2147 — 5y
0
So is that because you confused the terms "Client" and "Server"? theking48989987 2147 — 5y
0
yes im confused dizzyjamison08 30 — 5y
0
I fixed some indentation. TheeDeathCaster 2368 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

You should use : instead of . here:

 local equiped = Values:InvokeClient(player) -- change . to :
10      print(equiped)
Ad

Answer this question