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

TweenService for ImageTransparency not working in LocalScript?

So i've tried to run the code in a LocalScript, disabling and undisabling LocalScripts and tried to use a remoteEvent. However none of that worked so i'm here to ask if im doing something wrong.

Here's my current script which is using the remoteEvent statement:

local ui = script.Parent
local titleScreen = ui:FindFirstChild("Main")
local openingEyes = ui:FindFirstChild("Eyes")
local playButton = ui:FindFirstChild("Play")
local RPS = game:GetService("ReplicatedStorage")
local Remotes = RPS:WaitForChild("Remotes")
local transparencyRemote = Remotes:WaitForChild("ImageTransparency")

playButton.MouseButton1Down:Connect(function()
	transparencyRemote:FireServer(playButton,1,1)
	playButton:TweenPosition(UDim2.new(0.357, -3000, 0.714, 0),"Out")
	game.Workspace.menuTheme:Stop()
	
	wait(1)
	
	transparencyRemote:FireServer(titleScreen,1,1)
	
	wait(1)
	
	transparencyRemote:FireServer(openingEyes,1,1)
end)

And here is my reciever script:

local RPS = game:GetService("ReplicatedStorage")
local Remotes = RPS:WaitForChild("Remotes")
local transparencyRemote = Remotes:WaitForChild("ImageTransparency")

transparencyRemote.OnServerEvent:Connect(function(player,gui,speedTime,transparency)
	game:GetService("TweenService"):Create(gui,TweenInfo.new(speedTime),{ImageTransparency = transparency})
end)

Can anyone tell me whats wrong?

3 comments

0

Guis are exclusively modifed inside local scripts, unless using surface or billboard guis. Remotes aren't needed and wont work. You need to tween the guis inside a local script. Player guis are stored inside game.Players.LocalPlayer.PlayerGui

0

Ok I'll try that thanks.

0

No problem. It looks like your code was correct, just not being used correctly. Instead of firing a remote, setup a function inside the local script that does the same thing the remote does and call that function instead of :FireServer

1 answer

Ok I realised my problem was I forgot to add :Play()

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