Hello! So I’m trying to make a music game kind of like robeats, But the thing is the Keybind’s aren’t working, heres the script and heres the error
local ButtonItself = script.Parent
local TickClone = game.Workspace.LeftPlayerMainTick:GetChildren("LeftPlayerMainTickClone")
game.Players.LocalPlayer:GetMouse().KeyDown:Connect(function(key)
if key == "s" then -- Miss If The Player Just Clicks
ButtonItself.Material = "Neon"
else
if key == "s" and TickClone.Position == Vector3(-1, 0.5, 16.5) or Vector3(-1, 0.5, 23.5) then -- Close If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
else
if key == "s" and TickClone.Position == Vector3(-1, 0.5, 17) or Vector3(-1, 0.5, 23) then -- Great If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
else
if key == "s" and TickClone.Position == Vector3(-1, 0.5, 17.5) or Vector3(-1, 0.5, 21) or Vector3(-1, 0.5, 18) or Vector3(-1, 0.5, 22) or Vector3(-1, 0.5, 18.5) or Vector3(-1, 0.5, 19.5) or Vector3(-1, 0.5, 20.5) then -- Great If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
else
if key == "s" and TickClone.Position == Vector3(-1, 0.5, 20) then -- Epic If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
end
end
end
end
end
end)
Error
08:55:31.315 Music Rush auto-recovery file was created - Studio - C:/Users/mrtix/OneDrive/Documents/ROBLOX/AutoSaves
08:55:34.169 Workspace.LeftPlayerDetecter.Script:4: attempt to index nil with 'GetMouse' - Server - Script:4
08:55:34.169 Stack Begin - Studio
08:55:34.169 Script 'Workspace.LeftPlayerDetecter.Script', Line 4 - Studio - Script:4
08:55:34.170 Stack End - Studio
08:55:57.397 0.5, 0.5 - Server
08:55:57.817 0.5, 0.5 - Client
08:56:43.885 Disconnect from ::ffff:127.0.0.1|64453 - Studio
08:58:11.277 ▶ Music Rush auto-recovery file was created (x2) - Studio - C:/Users/mrtix/OneDrive/Documents/ROBLOX/AutoSaves
10:06:04.018 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:06:04.019 Stack Begin - Studio
10:06:04.019 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:06:04.019 Stack End - Studio
10:06:04.928 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:06:04.930 Stack Begin - Studio
10:06:04.931 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:06:04.932 Stack End - Studio
10:06:06.443 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:06:06.443 Stack Begin - Studio
10:06:06.444 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:06:06.444 Stack End - Studio
10:06:06.959 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:06:06.960 Stack Begin - Studio
10:06:06.960 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:06:06.961 Stack End - Studio
10:06:07.742 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:06:07.743 Stack Begin - Studio
10:06:07.743 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:06:07.744 Stack End - Studio
10:06:07.878 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:06:07.878 Stack Begin - Studio
10:06:07.878 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:06:07.879 Stack End - Studio
10:06:08.560 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:06:08.561 Stack Begin - Studio
10:06:08.561 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:06:08.562 Stack End - Studio
10:06:08.944 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:06:08.944 Stack Begin - Studio
10:06:08.945 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:06:08.945 Stack End - Studio
Here is the Updated Code,
local UserInputService = game:GetService("UserInputService")
local ButtonItself = game.Workspace.LeftPlayerDetecter
local TickClone = game.Workspace.LeftPlayerMainTick:GetChildren("LeftPlayerMainTickClone")
UserInputService.InputBegan:Connect(function(inputObject, gameProccessedEvent)
if (inputObject.KeyCode == Enum.KeyCode.S) then -- Miss If The Player Just Clicks
ButtonItself.Material = "Neon"
else
if (inputObject.KeyCode == Enum.KeyCode.S) and TickClone.Position == Vector3(-1, 0.5, 16.5) or Vector3(-1, 0.5, 23.5) then -- Close If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
else
if (inputObject.KeyCode == Enum.KeyCode.S) and TickClone.Position == Vector3(-1, 0.5, 17) or Vector3(-1, 0.5, 23) then -- Great If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
else
if (inputObject.KeyCode == Enum.KeyCode.S) and TickClone.Position == Vector3(-1, 0.5, 17.5) or Vector3(-1, 0.5, 21) or Vector3(-1, 0.5, 18) or Vector3(-1, 0.5, 22) or Vector3(-1, 0.5, 18.5) or Vector3(-1, 0.5, 19.5) or Vector3(-1, 0.5, 20.5) then -- Great If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
else
if (inputObject.KeyCode == Enum.KeyCode.S) and TickClone.Position == Vector3(-1, 0.5, 20) then -- Epic If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
end
end
end
end
end
end)
local UserInputService = game:GetService("UserInputService")
local ButtonItself = game.Workspace.LeftPlayerDetecter
local TickClone = game.Workspace.LeftPlayerMainTick:GetChildren("LeftPlayerMainTickClone")
UserInputService.InputBegan:Connect(function(inputObject)
if inputObject.KeyCode == Enum.KeyCode.S then -- Miss If The Player Just Clicks
ButtonItself.Material = "Neon"
else
if inputObject.KeyCode == Enum.KeyCode.S and TickClone.Position == Vector3(-1, 0.5, 16.5) or Vector3(-1, 0.5, 23.5) then -- Close If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
else
if inputObject.KeyCode == Enum.KeyCode.S and TickClone.Position == Vector3(-1, 0.5, 17) or Vector3(-1, 0.5, 23) then -- Great If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
else
if inputObject.KeyCode == Enum.KeyCode.S and TickClone.Position == Vector3(-1, 0.5, 17.5) or Vector3(-1, 0.5, 21) or Vector3(-1, 0.5, 18) or Vector3(-1, 0.5, 22) or Vector3(-1, 0.5, 18.5) or Vector3(-1, 0.5, 19.5) or Vector3(-1, 0.5, 20.5) then -- Great If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
else
if inputObject.KeyCode == Enum.KeyCode.S and TickClone.Position == Vector3(-1, 0.5, 20) then -- Epic If The Player Clicks and the Position Of The Clone Is Vector3(Position)
ButtonItself.Material = "Neon"
end
end
end
end
end
end)
10:30:48.001 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:30:48.001 Stack Begin - Studio
10:30:48.002 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:30:48.002 Stack End - Studio
10:30:48.185 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:30:48.185 Stack Begin - Studio
10:30:48.186 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:30:48.186 Stack End - Studio
10:30:50.235 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:30:50.237 Stack Begin - Studio
10:30:50.237 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:30:50.238 Stack End - Studio
10:30:51.002 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:30:51.003 Stack Begin - Studio
10:30:51.003 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:30:51.004 Stack End - Studio
10:30:51.534 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:30:51.535 Stack Begin - Studio
10:30:51.535 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:30:51.536 Stack End - Studio
10:30:51.835 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:30:51.836 Stack Begin - Studio
10:30:51.836 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:30:51.836 Stack End - Studio
10:30:52.036 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:30:52.036 Stack Begin - Studio
10:30:52.038 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:30:52.039 Stack End - Studio
10:30:52.600 Players.NubblyFry.PlayerScripts.LeftDetecterHandler:9: attempt to call a table value - Client - LeftDetecterHandler:9
10:30:52.600 Stack Begin - Studio
10:30:52.601 Script 'Players.NubblyFry.PlayerScripts.LeftDetecterHandler', Line 9 - Studio - LeftDetecterHandler:9
10:30:52.601 Stack End - Studio
You’re using “or” wrong. you must specify it every “or”
if (inputObject.KeyCode == Enum.KeyCode.S) and TickClone.Position == Vector3(-1, 0.5, 16.5) or (inputObject.KeyCode == Enum.KeyCode.S) and TickClone.Position == Vector3(-1, 0.5, 23.5) then
end
or Vector3(-1, 0.5, 21) or Vector3(-1, 0.5, 18) or Vector3(-1, 0.5, 22) or Vector3(-1, 0.5, 18.5) or Vector3(-1, 0.5, 19.5) or Vector3(-1, 0.5, 20.5)
by doing that you’re confusing the script what do you mean by simply “vector3?” is what the script is basically getting.
and it’s erroring because its “vector3.new” not “vector3”