How to make a part tween on an individual client?

So I’m trying to create a script that makes a part move / tween for a specific client, which means that the part should not move for the other clients, and rather just stay in the original position.

Just to clarify, I’m trying to make a door tween to another position once a player has reached a certain level.

Can’t manage to figure it out, would appreciate some advice :slight_smile:

If you’re using FilteringEnabled, you should be able to just change the CFrame on the client. The changes won’t replicate to the server.

oh, right

Hi there !

TweenService is here to help you out :slight_smile:
http://wiki.roblox.com/index.php?title=API:Class/TweenService

Thanks @Velibor , but I know how to tween the object, I just don’t know how to do it on a specific client, and not on the server.

If you simply call the tween on the client (assuming you can) with FilteringEnabled on, you can make it only replicate to the client.

(EDIT: It appears that you can call TweenService on the client; the wiki does not say you cannot.)

Yeah, I’m trying to perform it on the client, and added a copy of the script below in the stats folder located in ‘game.Players.PlayerName’, but it’s not working for some reason.
I’m probs doing something wrong :confused:

Bridge1 = game.Workspace.LevelModels:WaitForChild(‘Bridge1’)
local Level = script.Parent:WaitForChild(‘LevelProgress’)
local CurrentCFrame = Bridge1.CFrame
local CurrentOrientation = CurrentCFrame - CurrentCFrame.p
local info = TweenInfo.new(5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)

Debounce = false

repeat wait() until Level.Value >= 10
if Level.Value >= 10 and Debounce == false then
Debounce = true
local PositionTween = game:GetService(“TweenService”):Create(Bridge1, info,{CFrame = CFrame.new(154.615, 5.205, -43.215) * CurrentOrientation})
PositionTween:Play()
Debounce = false
end

Try this code… (this is assuming “LevelProgress” is located directly inside the player object itself)

Bridge1 = game.Workspace.LevelModels:WaitForChild(‘Bridge1’)
local Player = game.Players.LocalPlayer
local Level = Player:WaitForChild(‘LevelProgress’)
local CurrentCFrame = Bridge1.CFrame
local CurrentOrientation = CurrentCFrame - CurrentCFrame.p
local info = TweenInfo.new(5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out)

Debounce = false

repeat wait() until Level.Value >= 10
if Level.Value >= 10 and Debounce == false then
Debounce = true
local PositionTween = game:GetService(“TweenService”):Create(Bridge1, info,{CFrame = CFrame.new(154.615, 5.205, -43.215) * CurrentOrientation})
PositionTween:Play()
Debounce = false
end

Should I put that in a LocalScript or a normal one?

btw, should I put the script somewhere else than inside the Player?

You can put it in a LocalScript located in StarterPlayer > StarterPlayerScripts

alright, thanks

Making changes on a singular client isn’t too difficult a task, especially in FilteringEnabled.

The changes you make from a LocalScript with FilteringEnabled ticked will not replicate to the rest of the clients, only the client in which the script is running from.

There are a few good resources to understand FilteringEnabled and why changes do or don’t replicate, but I would personally say the wiki is the most prominent way to gain a basic understanding:
http://wiki.roblox.com/index.php?title=API:Class/Workspace/FilteringEnabled

This response is a bit broad, but I’m attempting to explain it in a way that will help you in future instances, understanding FilteringEnabled is a good step to take.

1 Like