local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local part = game.Workspace:WaitForChild("House1")
local primPart = part:WaitForChild("HitBox")
local Posi = part:GetPivot()
local tweenService = game:GetService("TweenService")
local primPos = primPart.CFrame.Position
local UIS = game:GetService("UserInputService")
local EV = game.ReplicatedStorage.Placing
local Xup = nil
local Zup = nil
local y = Posi.Y
local canPlace = false
local ValuePos = Instance.new("Vector3Value")
ValuePos.Parent = game.Workspace
local function Move()
wait(0.25)
local x,z = mouse.Hit.X, mouse.Hit.Z
Xup = math.floor(x / 4 + 0.5) * 4
Zup = math.floor(z / 4 + 0.5) * 4
local tweenInfo = TweenInfo.new(
0.25,
Enum.EasingStyle.Back,
Enum.EasingDirection.Out,
0,
false,
0
)
local tweenPart = tweenService:Create(ValuePos, tweenInfo, {Value = Vector3.new(Xup,y,Zup)})
tweenPart:Play()
local filter = OverlapParams.new()
filter.FilterType = Enum.RaycastFilterType.Exclude
filter.FilterDescendantsInstances = {game.Workspace.Baseplate, player.Character, part}
local foundParts = workspace:GetPartsInPart(part.HitBox, filter)
if foundParts[1] ~= nil then
part.Highlight.FillColor = Color3.new(255,0,0)
canPlace = false
else
part.Highlight.FillColor = Color3.new(0,255,0)
canPlace = true
end
end
ValuePos:GetPropertyChangedSignal("Value"):Connect(function()
primPart.Position = ValuePos.Value
end)
local function Rotate(input)
if input.KeyCode == Enum.KeyCode.R then
local OriX,OriY,OriZ = primPart.Orientation.X, primPart.Orientation.Y, primPart.Orientation.Z
print(OriX,OriY,OriZ)
primPart.Orientation = Vector3.new(OriX,OriY+90,OriZ)
end
end
mouse.Move:Connect(Move)
This is the script I have so far. I am having trouble with this
local tweenPart = tweenService:Create(ValuePos, tweenInfo, {Value = Vector3.new(Xup,y,Zup)})
tweenPart:Play()
And
ValuePos:GetPropertyChangedSignal("Value"):Connect(function()
primPart.Position = ValuePos.Value
end)
I have welded everything together properly but it does not seem to work. The primary part moves but nothing else does. I saw a devforum post and it said that it will not move during tweening unless you use CFrame which does not work in my situation!
HELP!