Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Playing Tween Animations on Client?

I'm trying to make a door that opens upon clicking the handle of the door, and I think if someone were to spam click the handle on the door, it would probably lag the server or just plain out annoy people. So I want it to play client so it would be smooth and not really laggy. Another example so you can better understand it: A player is sitting in a chair next to the door, another player joins the game and clicks the door handle and it opens, but on the player sitting on the chair doesn't see the door open; he just sees the other player just walk through the door. (Sorry if you can't read the code well, I'm new to this site)

Code used for the door: local TweenService = game:GetService("TweenService") local Door = script.Parent local Nob = Door.Nob local Nob2 = Door.Nob2 local Open = false local tweeninfo = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0) local tween = TweenService:Create(Door,tweeninfo,{CFrame = Door.Parent.DoorOpen.CFrame}) local tween2 = TweenService:Create(Door,tweeninfo,{CFrame = Door.Parent.DoorClosed.CFrame})

Nob.ClickDetector.MouseClick:Connect(function() if Open == false then tween:Play() Open = true wait(4) tween2:Play() Open = false end end)

Nob2.ClickDetector.MouseClick:Connect(function() if Open == false then tween:Play() Open = true wait(4) tween2:Play() Open = false end end)

2 comments

0

shouldn't lag server if u have debounce

0

I just want it client side no matter what.

1 answer

Copy your code, make a local script in StarterPlayerScripts, Paste your code in that local script, redefine the variables if you used script.Parent and stuff, and delete your normal script inside of your door. Now try it.

This discussion is preserved as it was. New answers, comments, and votes are closed.