-
What do you want to achieve?
I’m trying to create a game like RoBeats, I have gotten far and I can move the notes by cloning them onto workspace tweening them. My goal now is to make the buttons work but I don’t know how. -
What is the issue?
I’ve been struggling for a few days trying to detect a moving part’s position with the press of a key. Another problem is that the notes ignore collisions as they are being tweened. -
What solutions have you tried so far?
I’ve tried methods like hitboxes and position tracking but none of them worked.
The Keybind script is a LocalScript located in StarterCharacterScripts, and this is currently what it has:
-- This is only for one lane.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local Beams = ReplicatedStorage:WaitForChild("Beams")
local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
debounce = false
UserInputService.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode["A"] then
-- This just creates the light effect when the key is pressed.
local Beam = Beams.A:Clone()
Beam.Parent = game:GetService("Workspace")
local Properties = {
Size = Vector3.new(17, 0.4, 0.4);
Transparency = 1
}
ocal Info = TweenInfo.new(0.4)
local Tween = TweenService:Create(Beam, Info, Properties)
Tween:Play()
wait(0.4)
Beam:Destroy()
end
end)
How to detect a moving part’s position with a keybind?
Thanks in advance for the help!