Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago
Edited 3 years ago
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

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. VikkiVuk 74 — 3y
0
ok go3jack 1 — 3y
0
i made it a non request go3jack 1 — 3y
0
got an error while merging code go3jack 1 — 3y
0
expected end to close then at line 2 got <eof> go3jack 1 — 3y

Closed as Not Constructive by zadobyte, megukoo, Cynical_Innovation, moo1210, and JesseSong

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by
zadobyte 692 Moderation Voter
3 years ago

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
Ad