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

How do I make a object move based on if a player clicks a button?

Asked by 6 years ago
Edited 6 years ago

How do I make this part move?

01local UIS = game:GetService('UserInputService')
02 
03subinput = UIS.InputBegan:connect(function(input,gameProcessedEvent)
04 
05if gameProcessedEvent then return end
06 
07if input.KeyCode == Enum.KeyCode.Space then
08 
09local part = Instance.new("Part")
10 
11part.Position = game.Workspace.world_kiIIer.RightFoot.Position
12 
13part.Transparency = 1
14 
15part.Size = Vector3.new(4, 1, 4)
16 
17part.CanCollide = true
18     
19wait(2)
20 
21part:Destroy()
22 
23end
24 
25end)
0
On line 11 change it to | part.CFrame = game.Workspace.world_kiLLer.RightFoot.CFrame | I may have spelt world_kiLLer wrong, I don't know if they are capital I's or capital l's. TheOnlySmarts 233 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

To move a part you want to CFrame it. CFrame’s can be used to change the position and orientation of a part.

For more information about CFrames click this Roblox Wiki link:

https://developer.roblox.com/api-reference/property/BasePart/CFrame

Ad

Answer this question