RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Create a part that plays a loading screen located on screen gui on player touch"
-- server script for the part local part = script.Parent local function playLoadingScreen(otherPart) local player = game.Players:FindFirstChild(otherPart.Parent.Name) if player then local loadingScreen = player.PlayerGui:FindFirstChild("LoadingScreen") if loadingScreen then game.ReplicatedStorage.PlayLoadingScreen:FireClient(player) end end end part.Touched:Connect(playLoadingScreen) -- server script in ReplicatedStorage local remoteEvent = Instance.new("RemoteEvent") remoteEvent.Name = "PlayLoadingScreen" remoteEvent.Parent = game.ReplicatedStorage -- local script in StarterPlayerScripts local replicatedStorage = game:GetService("ReplicatedStorage") local player = game.Players.LocalPlayer local loadingScreen = player.PlayerGui.LoadingScreen replicatedStorage.PlayLoadingScreen.OnClientEvent:Connect(function() loadingScreen.Enabled = true wait(5) -- Change this value to the duration of the loading screen loadingScreen.Enabled = false end)