Hello! This is my first topic so excuse me if it’s bad. In this tutorial, i’ll show you how to send non-replicated objects in remote events, like functions, tween infos, etc. this example will be with a tween info
So first, create a module script in replicated storage called “TweenInfos” or something like that, and type this:
local tween_infos = {}
return tween_infos
we will store our tween infos inside this module.
Now from here, we need to add the tween infos inside this tween_infos table
storing the infos inside the module:
local tween_infos = {
["TWEENINFOIDHERE"] = TweenInfo.new(2) -- tweeninfo here
}
return tween_infos
next, we will send the id of the tween info to the client, which will then get the tween info and play the tween!
local script:
local replicated_storage = game:GetService("ReplicatedStorage")
local tween_service = game:GetService("TweenService")
local tween_remote = replicated_storage:WaitForChild("TweenEvent")
local tween_infos = require(replicated_storage:WaitForChild("TweenInfos"))
tween_remote.OnClientEvent:Connect(function(object:Instance, info_id, goals)
local success, info = pcall(function() -- do this so the script wont break if the info id is invalid
return tween_infos[info_id]
end)
if success and info then
tween_service:Create(object, info, goals):Play() -- finally, play the tween!
else
warn(string.format("could not found tween info with id of %q", info_id)) -- if the info isn't found, we'll add a warning to the output so we can debug
end
end)
this is our server script
local replicated_storage = game:GetService("ReplicatedStorage")
local infos = require(replicated_storage:WaitForChild("TweenInfos"))
local tween_remote = replicated_storage:WaitForChild("TweenEvent")
local part = workspace.Part
local info_id = "ColorTween"
local goals = {
Color = Color3.fromRGB(75, 93, 255) --- pastel purple
}
task.wait(2) -- so we can see the tween
tween_remote:FireAllClients(part, info_id, goals)
there we go. hope this helps
the final result is really nice
Hope this helps. If u have any questions then feel free to ask