gives me 2 wood instead of 1 wood, I need it to be 1 wood?
Asked by
3 years ago Edited 3 years ago
I was following a tutorial with a bit of changes, but when I pressed F it would five me double the amount of wood, and when I press anything else then F or click the wood I get the normal amount. I just want it to give me the normal amount.
btw there is not a error.
01 | local UIS = game:GetService( "UserInputService" ) |
02 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
03 | local PickupItem = ReplicatedStorage:WaitForChild( "Remotes" ):WaitForChild( "PickupItem" ) |
06 | local player = game.Players.LocalPlayer |
07 | local mouse = player:GetMouse() |
09 | local PlayerGui = player:WaitForChild( "PlayerGui" ) |
10 | local PickupInfoGui = PlayerGui:WaitForChild( "PickupInfoGui" ) |
12 | UIS.InputChanged:Connect( function (input) |
14 | if mouse.Target:FindFirstChild( "Pickable" ) then |
15 | local item = mouse.Target |
16 | PickupInfoGui.Adornee = item |
17 | PickupInfoGui.ObjectName.Text = item.Name |
18 | PickupInfoGui.Enabled = true |
20 | PickupInfoGui.Adornee = nil |
21 | PickupInfoGui.Enabled = false |
27 | UIS.InputEnded:Connect( function (input) |
28 | if input.KeyCode = = Enum.KeyCode.F then |
30 | if mouse.Target:FindFirstChild( "Pickable" ) then |
31 | local item = mouse.Target |
33 | local distanceFromItem = player:DistanceFromCharacter(item.Position) |
34 | if distanceFromItem < 30 then |
35 | PickupItem:FireServer(item) |
43 | UIS.InputEnded:Connect( function () |
45 | if mouse.Target:FindFirstChild( "Pickable" ) then |
46 | local item = mouse.Target |
49 | local DistanceFromItem = player:DistanceFromCharacter(item.Position) |
50 | if DistanceFromItem < 30 then |
51 | PickupItem:FireServer(item) |