Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to make a model move onto the player's head and fall off of their head when they press a key?

local TweenService = game:GetService("TweenService")
 
local part = Instance.new("Part")
part.Position = Vector3.new(0, 10, 0)
part.Color = Color3.new(0, 0, 0)
part.Anchored = false
part.Parent = game.Workspace
 
local goal = {39.7, 0.5, -127.5}
goal.Position = Vector3.new(10, 10, 0)
goal.Color = Color3.new(0, 1, 0)
 
local tweenInfo = TweenInfo.new(5)
 
local tween = TweenService:Create(part, tweenInfo, goal)
 
tween:Play() 

that is an example of my code. so it is reaching the spawn location where the player is most likely at and it is not working

5 comments

0

this is not a request site, if you dont have any code in this, then we can't help you, and your question will most likely be closed as off-topic.

0

ok

0

i made it a non request

0

got an error while merging code

0

expected end to close then at line 2 got

1 answer

✓ Accepted answer

It'd pay off to use something like UserInputService.InputBegan to detect when a key is pressed. Here's what that should look like:

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.(key here) then

This discussion is preserved as it was. New answers, comments, and votes are closed.