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
You should use : instead of . here:
local equiped = Values:InvokeClient(player) -- change . to : 10 print(equiped)