Tweening Position Problem

Hello there, I’m pixeluted and I trying do elevator but I want in server tween frame
But It’s not working How I want
Script

script.Parent.Close.OnServerEvent:Connect(function(player,Way)
	player.Character.HumanoidRootPart.CFrame = workspace.Elevators[Way].Teleport.CFrame + Vector3.new(0,3,0)
	script.Parent:TweenPosition(UDim2.new(-1.5, 0,0.5, 0))
	print("Closed")
end)

Explorer here


Thank for any ideas how to fix it.

2 Likes

How is it working then? How do you want it to work? We need more information.

1 Like

you have to add Enum.EasingDirection.Out, Enum.EasingStyle.Back, 5

1 Like

No I don’t need add I do it on server too only and it’s work

2 Likes

I just want do when player click on button then the frame tweens back

1 Like

can you show the error maybe then we are can have more info and help you?

1 Like

I don’t getting any error So .

1 Like

So you want, when a player clicks the button, the elevator comes down to the level where the player pressed the button?

1 Like

Yes and then GUI tween back you know

2 Likes

Server scripts will not run in the player’s PlayerGui. Either switch the script for a LocalScript or move it to a place where it will run, such as ServerScriptService.

1 Like

This is false. Server Scripts can run in the PlayerGui. However, it is recommended you do not use server Scripts in PlayerGui because PlayerGui is meant for visuals, and it makes more sense to handle visuals on the client.

You will also be unable to interact with any inputs a player may generate if you’re using a server Script

Here is proof for my claim by the way:
I am printing the Parent.Name of the script every ~0.03 seconds.

while true do
	print(script.Parent.Name)
	wait()
end

I suggest you to use this function instead of TweenPosition as TweenService is way more reliable.

local Tween           = function(Object, Time, Customization)
    TweenService:Create(Object, TweenInfo.new(Time), Customization):Play()
end;

How you would use it for example the part that didn’t work before:

Tween(script.Parent, 1, {Position = UDim2.new(-1.5, 0, .5, 0)})
3 Likes

He probably meant they are prefered not to be in the PlayerGui.

1 Like

No sir I doing with Touch event the position tween but If I want to do it again I need close in server or in server is still opened but in local isn’t opened so if I want open it server don’t open it bc server think is already opened

You should make it to Localscript in order to make the script work