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

How to Tween Transparency of a Part?

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

✓ Accepted answer

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)

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