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

Script doesn't work with table, works with single value?

Asked by
Ben_B 9
4 years ago

instead of writing the code out all again what could i do?

01local enabled = true
02local ding = game.Workspace.Sounds.Ding             -- sound
03local part = {game.Workspace.Configuration.Koala1, game.Workspace.Configuration.Koala2, game.Workspace.Configuration.Koala3}    -- name
04local player = game.Players.LocalPlayer
05local mouse = player:GetMouse()
06local UserInputService = game:GetService("UserInputService")
07local gui = player:WaitForChild("PlayerGui")
08local toolup = gui:WaitForChild("clickE")
09local maxpickup = 20
10local KoalaGUI = player.PlayerGui.KoalaAdd
11 
12 
13    local pp = player.leaderstats.Credits
14    UserInputService.InputBegan:Connect(function(input,gameProccesedEvent)
15 
View all 39 lines...

1 answer

Log in to vote
0
Answered by 4 years ago

Hello. You have to use an in pairs loop. It loops through a table. Try this:

01local enabled = true
02local ding = game.Workspace.Sounds.Ding             -- sound
03local parts = {game.Workspace.Configuration.Koala1, game.Workspace.Configuration.Koala2, game.Workspace.Configuration.Koala3}    -- name
04local player = game.Players.LocalPlayer
05local mouse = player:GetMouse()
06local UserInputService = game:GetService("UserInputService")
07local gui = player:WaitForChild("PlayerGui")
08local toolup = gui:WaitForChild("clickE")
09local maxpickup = 20
10local KoalaGUI = player.PlayerGui.KoalaAdd
11 
12 
13    local pp = player.leaderstats.Credits
14    UserInputService.InputBegan:Connect(function(input,gameProccesedEvent)
15 
View all 41 lines...

Please accept and upvote this answer if it helps.

0
The script does work, thank you , but it doesn't let me pick up another Koala for 5 seconds. I know its because I have a wait in there but. Ben_B 9 — 4y
0
No problem. Please accept this answer. youtubemasterWOW 2741 — 4y
Ad

Answer this question