How to make the ball fixed on my hand like this: https://gyazo.com/7ae5903ea140f650eb6e83abc6287f9e
COMMUNITY QUESTION
How to make a part fixed on my body part when I click a press a key ?
2 answers
local ball = script.Parent
local hand = put the location of hand here tbh i have no idea how to
while true do
wait()
local handposy = hand.Position.Y
ball.Position = hand.Position - Vector3.new(0,handposy / 2,0)
end
no idea if its gonna work and idk if this is what u want to do if it works then accept
You first need to use userInputService.
local UIS = game:GetService("UserInputService")
local key = Enum.KeyCode.Q --//Use whatever key you want them to click
local on = false
local ball
UIS.InputBegan:Connect(function(input, gameProcessed)
on = not on
if on == false then
local player = game.Players.LocalPlayer
if input.KeyCode == key then
local OriginalBall = game:GetService("ReplicatedStorage").Ball
ball = OriginalBall:Clone()
ball.Parent = workspace
local char = player.Character or player.CharacterAdded:Wait()
ball.CFrame = char.LeftHand.CFrame
local newWeld = Instance.new("Weld")
newWeld.Parent = ball
newWeld.Part0 = char.LeftHand
newWeld.Part1 = ball
end
elseif on == true then
if input.KeyCode == key then
ball:Destroy()
end
end
end)
Say the OriginalBall variable is in ReplicatedStorage so you clone that to the workspace
I'm not sure if this will work or not as I haven't tested. But sorry if it didn't work, I tried my best.
3 comments
0
how to know ball position ??
0
Ur script is working but how do I press that same key to turn it off?
0
I edited my script, have a look now
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
Not work :()
whats the error
oh wait i forgot one thing im gonna edit the script
try now and tell me the errors if it doesnt
Seriously, weld it
oh ye lol
pls add in soon