I have a script that will teleport a person from one part to the other.
function onTouch(hit) -- the script is in a part if not isTouch then if hit.Parent:FindFirstChild("Humanoid") then showLoadingScreen:FireAllClients("Telporting", sound) -- Call the remote event. The text will be the message displayed and the sound will be the teleport sound played local player = hit.Parent player.Torso.CFrame = secondPart.CFrame -- teleport to second part end end end
The Remote Event will basicially make GUI and it's text fade from Transparency 1 to 0. It is also supposed to have a little loading animation:
local function onLoadingScreen(text, sound) textLabel = text -- making the text in the label the text that is inputted for i=1, 0, .1 do -- a loop that should change transparency from 1 to 0 loadGui.BackgroundTransparency = i --changing the transparency of the frame loadGui.Message.TextTransparency = i -- changing the transparency of the Text inside the TextLabel inside the frame end local count = 0 local start = tick() sound:Play() while tick() - start > sound.TimeLength do -- while the sound being played is not over textLabel = textLabel .. string.rep('.', count) -- Animate a period ('.') repeating after the message e.g. Loading... count = (count + 1) % 4 -- increment the count wait(.3) end for i=0, 1, .1 do -- a loop that should change transparency from 1 to 0 loadGui.BackgroundTransparency = i loadGui.Message.TextTransparency = i end end showLoadingScreen.OnClientEvent:connect(onLoadingScreen) -- connecting the remote event to the function in this local script
I thought the code would work but unfortunately, the only thing that happens is the sound being played. The script that manipulates the GUI is a local script and is using PlayerGUI. I have no idea why absolutely nothing is happening except the sound being played. I also think the loading animation part is a little dodgy because I kinda lifted it from http://wiki.roblox.com/index.php?title=Custom_loading_screen but it shouldn't be the reason that nothing happens when the player steps on the teleporting part! What is wrong here?