So basically everything in my script is working fine except the wheat is teleporting instantly ontop of the dirt instead of slowly tweening up. Please help
local ServerStorage = game:GetService("ServerStorage")
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DirtFolder = game.Workspace.Dirt
local WheatClone = ServerStorage.Wheat
local Events = ReplicatedStorage.Events
local function grow(dirt)
if dirt.HasWheat.Value == false then
local wheat = WheatClone:Clone()
local GrowTime = dirt.GrowTime
wheat.Parent = dirt
dirt.HasWheat.Value = true
TweenService:Create(wheat.PrimaryPart, TweenInfo.new(0), {CFrame = dirt.CFrame * CFrame.new(0, -1.3, 0) * CFrame.Angles(0, 0, 77)}):Play()
TweenService:Create(wheat.PrimaryPart, TweenInfo.new(DirtFolder.TimeToGrow.Value), {CFrame = dirt.CFrame * CFrame.new(0, 2, 0) * CFrame.Angles(0, 0, 77)}):Play()
while true do
task.wait(1)
if GrowTime.Value < DirtFolder.TimeToGrow.Value then
GrowTime.Value += 1
else
GrowTime.Value = 0
break
end
end
end
end
Events.Grow.OnServerEvent:Connect(function(player, Dirt)
if Dirt.HasWheat.Value == false then
grow(Dirt)
end
end)
Alright so first tweenservice is my cheap hack to move the whole model under the block (Welded to one piece) And it works in tact. Then the second tween is what appears to not work. When I removed it the wheat was underneath in the right spot but when I added it back the wheat instantly teleported to fully grown.
I did the number and it does the exact same thing meaning it doesnt tween up. Background information: it worked before perfectly then I added the event on when clicked which somehow broke it but I can’t figure out why. Local script for that but it should have nothing to do with it…
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local player = Players.LocalPlayer
local mouse = player:GetMouse()
local debounce = false
mouse.Button1Down:Connect(function()
if debounce == false then
debounce = true
local hit = mouse.Target
if hit.Parent == game.Workspace.Dirt then
ReplicatedStorage.Events.Grow:FireServer(hit)
task.wait(5)
debounce = false
end
end
end)
maybe try adding the remaining tweeninfo values ? mainly easingstyle
edit: now that i think about it if this was the issue it wouldnt work the first time so scrap that
my other guess is that maybe the tween is playing but another script is somehow already teleporting it to that position first, try to make the tween move the wheat to a completely random place and see if it tweens there