So i am trying to tween a model to go upwards by a certain height, however it results in the model getting teleported to random places. Here is a gif to show what is happening: https://gyazo.com/59e1f225c64c0b424f723c99e94b669b
I have a local script which recieves user input then fires a remote which does the tween.
Local Script:
local car = script.Parent.Car.Value
local hoverEvent = car:FindFirstChild("doHover")
local userInputService = game:GetService("UserInputService")
local hoverHeight = 10
local hovering = false
userInputService.InputBegan:Connect(function(input,gpe)
if gpe then return end
if input.KeyCode == Enum.KeyCode.X then
if not hovering then
hoverEvent:FireServer(false,hoverHeight,car)
else
hoverEvent:FireServer(true)
end
end
end)
Server Script:
local tweenService = game:GetService("TweenService")
script.Parent.OnServerEvent:Connect(function(plr,hovering,height,car)
if not hovering then
local CFrameValue = Instance.new("CFrameValue") CFrameValue.Name = "CFrameTween" CFrameValue.Parent = car.Body
local tween = tweenService:Create(CFrameValue,TweenInfo.new(2,Enum.EasingStyle.Bounce,Enum.EasingDirection.Out),{Value=CFrame.new(car.Body.PrimaryPart.CFrame.X,car.Body.PrimaryPart.CFrame.Y+height,car.Body.PrimaryPart.CFrame.Z)})
tween:Play()
CFrameValue:GetPropertyChangedSignal("Value"):Connect(function()
car:SetPrimaryPartCFrame(CFrameValue.Value)
tween.Completed:Connect(function()
CFrameValue:Destroy()
end)
end)
end
end)
I have tried looking through many other posts but couldn’t seem to make it work.
It doesn’t seem like everything is already anchored to me–the weird janky movement looks a lot like the kind of thing that’ll happen when tweening an unanchored assembly. It’s also worth noting that in this case, the player driving the car has network ownership of the car itself, so you’ll want to do the tween locally.
Putting info into ReplicatedStorage will make it so the clients can see it, yes. However, any changes made by the client won’t be seen by the server or other clients.
Im trying to achieve this without welding and just moving the model by the primarypart, is there any hope doing something like what im trying to do or am i going to have to try find a solution to weld?