Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

is it possible to tween a object when a remote function is fired?

Asked by
3wdo 198
4 years ago
Edited 4 years ago

im making a game based off the japanese game show the death pit.i want it so when someone says ready the platform will move. Can some one help me with my script? the first script is in serverscriptservice if that affects this

game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(message)
        if message == "ready" or "Ready" then
            game.ReplicatedStorage["Start Game"]:FireServer()
    end
end)
local TweenService = game:GetService("TweenService")
local PlatForm = script.Parent.Parent:WaitForChild("DisapearPart")
local tweeningInformation = TweenInfo.new(
    5,   
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)
local Move = {CFrame = CFrame.new(99.125, 177.707, -262.83)}
local ComeBack = {CFrame = CFrame.new(99.125, 177.707, -215.915)}
local tween1move = TweenService:Create(PlatForm,tweeningInformation,Move)
local tween1comeback = TweenService:Create(PlatForm,tweeningInformation,ComeBack)

game.ReplicatedStorage["Start Game"].OnServerEvent:Connect(function(player)
    tween1move:Play()

    wait(70)
    tween1comeback:Play()

end)

1 answer

Log in to vote
1
Answered by
Creacoz 210 Moderation Voter
4 years ago
Edited 4 years ago

I would do it all in 1 script since they're both on the server

local plr = game:GetService("Players").LocalPlayer
local TweenService = game:GetService("TweenService")
local PlatForm = game:GetService("Workspace").DisapearPart

local tweeningInformation = TweenInfo.new(
    5,   
    Enum.EasingStyle.Linear,
    Enum.EasingDirection.Out,
    0,
    false,
    0
)

local Move = {CFrame = CFrame.new(99.125, 177.707, -262.83)}
local ComeBack = {CFrame = CFrame.new(99.125, 177.707, -215.915)}
local tween1move = TweenService:Create(PlatForm,tweeningInformation,Move)
local tween1comeback = TweenService:Create(PlatForm,tweeningInformation,ComeBack)


game.Players.PlayerAdded:Connect(function(player)
    player.Chatted:Connect(function(message)
        if message:lower() == "ready" then
            tween1move:Play()
            wait(70)
            tween1comeback:Play()
        else
        print("Unknown")
        end
    end)
end)
Ad

Answer this question