local ClickDetector = game.Workspace.Map.Vent.VentBase.ClickDetector
local VentBase = Instance.new("Motor6D")
local VentPart = Instance.new("Motor6D")
local Vent = game.ReplicatedStorage.Vent
ClickDetector.MouseClick:Connect(function(player)
local chr = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local target = game.Workspace.Map.Vent.PrimaryPart
function lookAt(chr,target) --assume chr is a character and target is a brick to look towards
if chr.PrimaryPart then --just make sure the character's HRP has loaded
local chrPos=chr.PrimaryPart.Position --get the position of the HRP
local tPos=target.Position --get the position of the target
local newCF=CFrame.new(chrPos,tPos) --create our CFrame
chr:SetPrimaryPartCFrame(newCF) --set the HRP's CFrame to our result, thus moving the character!
end
end
player.Character:moveTo(Vector3.new(-42, 3, -27.61 ),lookAt(chr, target))
lookAt(chr, target)
game:GetService("ContextActionService"):BindActionAtPriority(
"t",
function()
return Enum.ContextActionResult.Sink
end,
false,
Enum.ContextActionPriority.High.Value + 1,
unpack(Enum.PlayerActions:GetEnumItems())
)
local newVent = Vent:Clone()
newVent.Parent = player.Character
VentBase.Name = "VentBase"
VentBase.Part0 = chr.HumanoidRootPart
VentBase.Part1 = chr.Vent.VentBase
VentBase.Parent = chr.HumanoidRootPart
VentPart.Name = "VentPart"
VentPart.Part0 = chr.Vent.VentBase
VentPart.Part1 = chr.Vent.VentPart
VentPart.Parent = chr.Vent.VentBase
--game.ReplicatedStorage.RemoteEvent:FireServer(player)
end)
game.ReplicatedStorage.RemoteEvent2.OnClientEvent:Connect(function(isnotMoving)
if isnotMoving == false then
game:GetService("ContextActionService"):UnbindAction("t")
end
end)
It’s highly unlikely that just changing the script will work. You will have to adapt it to work on the server. I would rather advise you to find a different solution to your problem rather than changing rigs mid game.
its a Vent animation, if I parent the vent model with the player character to after animate it, would that not also like move the vent model with the character?