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

How to Tween Transparency of a Part?

Asked by 3 years ago
local property = {
    Position = Vector3.new(-22.5, 0.5, -13.5)
}

local property2 = {
    Position = Vector3.new(0.041, -0.305, 0.064)
}

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tween = tweenService:Create(script.Parent,tweenInfo,property,{Transparency = 1})
local tween2 = tweenService:Create(script.Parent, tweenInfo, property2,{Transparency = 0})

game.ReplicatedStorage.RemoteEvent.StandOut.OnServerEvent:Connect(function(player)
    tween:Play()
end)

game.ReplicatedStorage.RemoteEvent.StandIn.OnServerEvent:Connect(function(player)
    tween2:Play()
end)

So I have another script that sends a remote event once a specific key is pressed, then it will activate the tweening, but I can't seems to be getting the transparency to work.

1 answer

Log in to vote
0
Answered by
cactz 15
3 years ago
Edited 3 years ago

You did put Argument 4 in :Create

local property = {
    Position = Vector3.new(-22.5, 0.5, -13.5);
    Transparency = 1
}

local property2 = {
    Position = Vector3.new(0.041, -0.305, 0.064);
    Transparency = 0
}

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)
local tween = tweenService:Create(script.Parent,tweenInfo,property)
local tween2 = tweenService:Create(script.Parent, tweenInfo, property2)

game.ReplicatedStorage.RemoteEvent.StandOut.OnServerEvent:Connect(function(player)
    tween:Play()
end)

game.ReplicatedStorage.RemoteEvent.StandIn.OnServerEvent:Connect(function(player)
    tween2:Play()
end)
Ad

Answer this question