-
What do you want to achieve?
Hello, i need to FireServer a TweenInfo but on the OnServerEvent it outputs as nil -
What is the issue?
I don’t know how can i fix that. -
What solutions have you tried so far?
I tried to fix it myself, checked for errors, looked on forums.
Hi. I need you to send your code to solve your problem.
Btw, have you tried putting the Tween info on the server already?
Hello, i don’t like to send my code in public so i will send you the most important parts of it.`
I have this variable (door tweeninfo)
local tInfo = TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
Then i fire the server (when i want to open my door)
ReplicatedStorage.Events.Client.Tween:FireServer(part.Door1, part.Door1Open.CFrame, tInfo)
Then on server event
ReplicatedStorage.Events.Client.Tween.OnServerEvent:Connect(function(player, toTween, toCFrame, Info)
ReplicatedStorage.Events.Client.Tween:FireAllClients(toTween, toCFrame, Info)
end)
Then it tween with my tweenmodel module
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenModelModule = require(ReplicatedStorage.TweenModel)
ReplicatedStorage.Events.Client.Tween.OnClientEvent:Connect(function(toTween, toCFrame, Info)
TweenModelModule.tweenModel(toTween, toCFrame, Info)
end)
yo wassup my man!
please include ur error too as it is the important part of the problem!
The error is that it’s just says that the TweenInfo is nil and when i print the tweeninfo it’s “nil”
may I ask where the error is located at? since the second argument should be the CFrame (in roblox the index go 1,2,3, and not 0,1,2)
local tween = TweenService:Create(cframeValue, Info, {Value = cframe})
tween:Play()
This is where the error is at
And this is CFrameValue
local cframeValue = Instance.new("CFrameValue")
cframeValue.Value = model:GetPrimaryPartCFrame()
cframeValue:GetPropertyChangedSignal("Value"):Connect(function()
model:SetPrimaryPartCFrame(cframeValue.Value)
end)
The problem is that the server is unable to get this tween info variable defined in the client. So, because of that, you will need to find another way of sending the tween information, such as adding more parameters or creating a function as an argument.
How can i make this work ???
I’ve found a way:
Client Code
-- TweenInfo arguments in array
local tInfo = {1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut}
ReplicatedStorage.Events.Client.Tween:FireServer(part.Door1, part.Door1Open.CFrame, tInfo)
Server Code
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TweenModelModule = require(ReplicatedStorage.TweenModel)
ReplicatedStorage.Events.Client.Tween.OnClientEvent:Connect(function(toTween, toCFrame, Info)
local tweeningInfo = TweenInfo.new(table.unpack(Info))
-- Unpack arguments to create a new TweenInfo object
TweenModelModule.tweenModel(toTween, toCFrame, tweeningInfo)
end)
Thank you for your help, it works!
How does this work? “.OnClientEvent” is not a valid server event, it should be “.OnServerEvent” instead.