I was trying to write a script that changes the position of the brick in the Workspace called test1. When the parent of the script is hitten by the player, test1 was supposed to change it's X, Y and Z values which is in the Position section of the part's properties. Please help! The script is here:
local Part = script.Parent
local X = game.Workspace.test1.Position.X
local Y = game.Workspace.test1.Position.Y
local Z = game.Workspace.test1.Position.Z
Part.Touched:connect(function(hit)
local H = hit.Parent:FindFirstChild("Humanoid")
if H then
wait(0.05)
X = -30.545
Y = 6.71
Z = -5
wait(0.05)
X = -30.545
Y = 6.71
Z = -6
wait(0.05)
X = -30.545
Y = 6.71
Z = -7
wait(0.05)
X = -30.545
Y = 6.71
Z = -8.5
wait(0.05)
X = -30.545
Y = 6.71
Z = -9
wait(0.05)
X = -30.545
Y = 6.71
Z = -10
wait(0.05)
X = -30.545
Y = 6.71
Z = -11
wait(0.05)
X = -30.545
Y = 6.71
Z = -12
wait(0.05)
X = -30.545
Y = 6.71
Z = -13
wait(0.05)
X = -30.545
Y = 6.71
Z = -14
wait(0.05)
X = -30.545
Y = 6.71
Z = -15
wait(0.05)
X = -30.545
Y = 6.71
Z = -16
wait(0.05)
X = -30.545
Y = 6.71
Z = -17
end
end)

2 comments
You are changing the variables, not the position
Can someone teach me how to script at lua bc i need it for my games