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

(my script is included) How do i make my block go from under the baseplate to above?

Asked by 4 years ago
local UIS = game:GetService('UserInputService')

local plr = game.Players.LocalPlayer

local Char = plr.Character or plr.CharacterAdded:Wait()

local model1p1 = game.Workspace.ElementalCircle.Model1.b1

local model1p2 = game.Workspace.ElementalCircle.Model1.b2

local model1p3 = game.Workspace.ElementalCircle.Model1.b3

local model1p4 = game.Workspace.ElementalCircle.Model1.b4

local model1p5 = game.Workspace.ElementalCircle.Model1.b5

local Key = 'F'

local circle = script.Parent.Parent.Parent.Parent.Workspace.ElementCircle

UIS.InputBegan:Connect (function(Input, IsTyping)

if IsTyping then return end

local KeyPressed = Input.KeyCode

if KeyPressed == Enum.KeyCode[Key] then

print(plr.Name..' had pressed ' ..Key)

local model1p1 = Vector3.new("-168, -20.5, 115")

wait(1)

local model1p1 = Vector3.new("163, 162, 165")

end

end)

thats what i put down and my blocks arent going from the ground to up

2 answers

Log in to vote
0
Answered by 4 years ago
local mouse = game.Players.LocalPlayer:GetMouse()

mouse.KeyDown:Connect(function(key)
if key == key:lower("f") then
local model1p1.CFrame = CFrame.new(163, 162, 165)
--and do this with the rest of them with the positions u want
end
end)

it gets ur mouse and if u press f (key:lower() means it dont matter if its a capital letter or not) then it gives the part a new cframe

Ad
Log in to vote
0
Answered by
pidgey 548 Moderation Voter
4 years ago
Edited 4 years ago

You have two problems. You instantiated 'model1p1' as a part located in workspace. Afterwards, where you presumably try and set model1p1's position, you actually just redefined the variable itself instead. To change the position of a part, you should be using the Position property:

model1p1.Position

Your second problem is that you're trying to use Vector3.new with a string argument. Vector3 takes 3 number arguments (x, y, z):

Vector3.new(-168, -20.5, 115)

Ultimately, setting the position of your part variable 'model1p1', should look like

model1p1.Position = Vector3.new(-168, -20.5, 115)

Hope this helps, and I couldn't use line references to your code because you didn't code block it.

Answer this question