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 5 years ago
Edited 5 years ago

How do I make this part move?

local UIS = game:GetService('UserInputService')

subinput = UIS.InputBegan:connect(function(input,gameProcessedEvent)

if gameProcessedEvent then return end

if input.KeyCode == Enum.KeyCode.Space then

local part = Instance.new("Part")

part.Position = game.Workspace.world_kiIIer.RightFoot.Position

part.Transparency = 1

part.Size = Vector3.new(4, 1, 4)

part.CanCollide = true

wait(2)

part:Destroy()

end

end)
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 — 5y

1 answer

Log in to vote
1
Answered by 5 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