#Coding pinball flippers

1 messages · Page 1 of 1 (latest)

frosty eagle
#

i need help coding a pinball mechanic in my game. i tried alot of different methods but it doesnt work.

lofty plinth
#

Can you tell us more about it @frosty eagle ?

frosty eagle
#

yeah. what im trying to do is make a pinball system but im stuck working one the flippers

tired heathBOT
#

studio** You are now Level 4! **studio

frosty eagle
#

i tried using tweens but that cause issues with collision.

#

heres the code for the left flipper

#

local input = game:GetService("UserInputService")
local TweenService = game:GetService("TweenService")

local flipper = game.Workspace.PINBALLFLIPPER1:WaitForChild("thing")
local motor = flipper.HingeConstraint
-- Settings
local tweeninfo = TweenInfo.new(0.1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out)

-- Settings
local restAngle = 0
local flipAngle = -45 -- Adjust this based on your flipper's orientation

-- Store the original position and the "flipped" position

input.InputBegan:Connect(function(key, processed)

if processed then return end
if key.KeyCode == Enum.KeyCode.Q then
    motor.TargetAngle = flipAngle
    print(motor.TargetAngle)    
    --flipDown:Cancel() -- Stop moving down if we are pressing up
    --flipUp:Play()
    --if flipper.CFrame == flippedCFrame then
    --    flipper.CFrame = originalCFrame
    --end
end

end)

input.InputEnded:Connect(function(key, processed)
--if processed then return end

if key.KeyCode == Enum.KeyCode.Q then
    motor.TargetAngle = restAngle    
    print(motor.TargetAngle)    
end

end)

lofty plinth
#

maybe just a for loop

#

or uh

#

use roblox physics

#

oh god

#

basicly

#

put a hinge on the spot where it turns

#

and give it velocity

#

and i wish you luck

frosty eagle
#

That's what I did

#

Some of the stuff is commented out btw

#

Because they were from my last attempts

lofty plinth
#

and what happened

#

did roblox physics bug the f out?

frosty eagle
#

I found out that collision doesn't work with tweens which was surprising

#

im trying out the HingeConstraint now