The tweening script works fine if the model is in workspace but when it is in replicated storage and cloned by a local script to workspace, it does nothing. I have tried searching it up but nothing seems to work, I even tried disabling the script and re-enabling it when the model gets cloned.
Script:
workspace.DescendantAdded:WaitForChild("Star")
print("Start")
local Colors = {BrickColor.new("Pastel yellow").Color, BrickColor.new("Cool yellow").Color, BrickColor.new("Daisy orange").Color, BrickColor.new("Bright yellow").Color, BrickColor.new("New Yeller").Color, BrickColor.new("Deep orange").Color}
local TweenService = game:GetService("TweenService")
local function ColorChange(ColorToChangeTo)
print("Function on")
local Union = script.Parent
local tweenInfoColor = TweenInfo.new(.9,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local ColorProperty = {}
ColorProperty.Color = ColorToChangeTo
local tween = TweenService:Create(Union,tweenInfoColor,ColorProperty)
tween:Play()
print("Tween playing")
wait(.9)
end
while true do
for i,v in ipairs(Colors) do
ColorChange(v)
end
end
well thats the main problem youre cloning using a local script and the tween script is a server script. since filtering enabled is in place “actions made by the client will no longer freely replicate to the server”.
a fix to this would be using a module script and calling it via local script. or when you use remoteevent/function to fire/invoke to server and let the server clone and insert the model from replicatedstorage into workspace.
could you elaborate on what you did?
-is the remote event firing from localscript to server and printing something?
-the codes of the serverscript and the localscript
-is the descendant “Star” being added?
The remote event is firing from the local script and printing something. If the remote event is fired, the local script will print("Fired successfully")
Server Side Code:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local changer = ReplicatedStorage:WaitForChild("ColorChanger")
print("Remote event obtained")
changer.OnServerEvent:Connect(function()
print("Start")
local Colors = {BrickColor.new("Pastel yellow").Color, BrickColor.new("Cool yellow").Color, BrickColor.new("Daisy orange").Color, BrickColor.new("Bright yellow").Color, BrickColor.new("New Yeller").Color, BrickColor.new("Deep orange").Color}
local TweenService = game:GetService("TweenService")
local function ColorChange(ColorToChangeTo)
print("Function on")
local Union = script.Parent
local tweenInfoColor = TweenInfo.new(.9,Enum.EasingStyle.Linear, Enum.EasingDirection.InOut, 0, false, 0)
local ColorProperty = {}
ColorProperty.Color = ColorToChangeTo
local tween = TweenService:Create(Union,tweenInfoColor,ColorProperty)
tween:Play()
print("Tween playing")
wait(.9)
end
while true do
for i,v in ipairs(Colors) do
ColorChange(v)
end
end
end)
Local Script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local arrow = ReplicatedStorage:WaitForChild("Arrow")
local changer = ReplicatedStorage:WaitForChild("ColorChanger")
local star = ReplicatedStorage:WaitForChild("Star")
arrow.OnClientEvent:Connect(function()
local player = game.Players.LocalPlayer
if workspace:FindFirstChild("Star") == nil then
local cloneStar = star:Clone()
cloneStar.Parent = game.Workspace
changer:FireServer()
print("Fired Successfully")
while true do
wait(.1)
local level = player:WaitForChild("leaderstats").Level.Value
if level == script.Levels.Value then
cloneStar:Destroy()
end
if game.Workspace.Checkpoints:FindFirstChild(level + 1) then
local ls = game.Workspace.Checkpoints:FindFirstChild(level + 1)
if cloneStar.PrimaryPart then
cloneStar:SetPrimaryPartCFrame(CFrame.new(ls.Position + Vector3.new(0,13.5,0)))
end
end
end
end
end)
if ur setting the setprimarypartcframe inside a severscript and if any localscript changes the position of the checkpoints then its gonna be inconsistent with the server and client (this is true vice-versa).
also like i said u can instead of using serverscript u could use localscripts instead but the “ColorChangingScript” would also have to be a module/localscript and called locally.
and yes u would have to change a lot of stuff u wrote for it to work the way u intended it to.
this is why good code design is important
I just want to get this to work by the weekend some I am willing to try anything But no serverscript is changing the position of the checkpoints, I will send you a video of what happens exactly.
from the gifs it has nothing to do with the tweening. this is entirely a different issue separate from tweening.
most likely theres issues with the weld/force being applied to your star motor or some script acting on it. i cant pinpoint the exact cause of the problem since i do not have enough resources to do so.
Is there anyway that the server script could find the cloned model in workspace?? Instead of me having to clone the model on the server script, it works better on the client and I want each player to see their own arrow as well as see the colour change.