You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want a part to move upwards endlessly while being touched.
What is the issue? My script i attempted to do is erroring
What solutions have you tried so far? attempted to do position but that failed in the script it just gave me an error
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local Part = script.Parent
Part.Touched:Connect(function()
while wait() do
print("Touching")
Part.Position.Y = Part.Position.Y +1
end
end)
Hello i’m trying to make a part go up in the air endlessy but the script errors why is this happening how can i make a part go in the y direction?
local Part = script.Parent
Part.Touched:Connect(function(thing)
if thing.Parent:FindFirstChild("Humanoid") then
game:GetService("TweenService"):Create(Part, TweenInfo.new(20), {Position = Vector3.new(Part.Position.X, Part.Position.Y + 200, Part.Position.Z)}):Play()
end
end)
local Part = script.Parent
Part.Touched:Connect(function(obj)
local Humanoid = obj.Parent:FindFirstChildWhichIsA("Humanoid")
if Humanoid then
Part.Position = Part.Position + Vector3.new(0,[[Number you want it to raise by]],0)
end
end)
Roblox does not let you directly edit the components of a vector3. You have to add or subtract using vector3’s (single numbers can be used for division and multiplication of vector3’s).
workspace.Part.Touched:Connect(function()
while true do
workspace.Part.Position += Vector3.new(0,1,0)
task.wait() --[[ use this from now on, wait() is deprecated
and constant use of wait() can cause slow downs
and can have delays of up to 1/60 (0.01667) sec or lower
]]
end
end)
local Part = workspace.Part--The Part to be touched
local Speed = 0.05--What you want the speed to be
Part.Touched:Connect(function(Hit)--When Touched
while task.wait() do--Create an infinite loop
Part.Position += Vector3.new(0, Speed, 0)--Start moving the Part
end
end)
local Part = script.Parent
Part.Touched:Connect(function()
while wait() do
print("Touching")
Part.Position = Vector3.new(Part.Position.X, Part.Position.Y + 1, Part.Position.Z)
end
end)