Players.Oficcer_F.Backpack.BananaDropper.DropBanana:15: attempt to compare number with userdata?
Trying to only be able to place 3 bananas on the ground, and then remove the tool and then needing to buy the tool every time...
This is my local script:
02 | player = game.Players.LocalPlayer |
03 | replicatedSotrage = game.ReplicatedStorage |
04 | script.Parent:WaitForChild( "BananLeft" ) |
05 | BananLeft = script.Parent.BananLeft |
06 | tool.Equipped:Connect( function (mouse) |
08 | player.PlayerGui.ScreenGui.BananCounter.Visible = true |
09 | mouse.Button 1 Down:Connect( function () |
11 | local position = mouse.Hit.p |
12 | local head = player.Character.Head |
13 | local distance = (head.Position - position).magnitude |
14 | if distance < 25 and BananLeft > 0 then |
17 | replicatedSotrage.SpawnBanana:FireServer(position) |
18 | BananLeft.Value = BananLeft.Value - 1 |
22 | if BananLeft.Value = = 0 then |
23 | game.ReplicatedStorage.DestroyTool:FireServer(player.Backpack.BananaDropper, player.StarterGear.BananaDropper) |
30 | tool.Unequipped:Connect( function (mouse) |
32 | player.PlayerGui.ScreenGui.BananCounter.Visible = false |
Server script:
01 | replicated = game.ReplicatedStorage.SpawnBanana.OnServerEvent:Connect( function (player, position) |
02 | local banana = game.ServerStorage.Banana:Clone() |
03 | banana.Parent = game.Workspace |
04 | banana.Position = Vector 3. new(position.X, position.Y, position.Z) |
08 | game.ReplicatedStorage.DestroyTool.OnServerEvent:Connect( function (player, backpackTool, starterGearTool) |
10 | backpackTool:Destroy() |
11 | starterGearTool:Destroy() |
This is the tool ancestry:
BananaDropper (Tool)
DropBanana (Local script)
BananLeft (IntValue)
Handle (Part)
Please help
Thanks
Is this osmething with that the intValue is inside the player??