This script was working fine two weeks ago but it doesn't work now and I don't know why. The script is supposed to make a GUI visible if you touch it, then make it disappear after 5 seconds. It worked fine two weeks ago but not anymore. I'm not on the computer I usually use, that one broke, maybe that's the problem? I know they just got rid of the legacy physics solver, but I doubt it's that - my game used and continues to use the PGS solver and it's a script so it shouldn't be affected by that, right?
local Part = game.Workspace.BelfastVoltisonGPSSignal Part.Touched:Connect(function(hit) if hit.Parent == game.Players.LocalPlayer.Character then game.Players.LocalPlayer.PlayerGui.BelfastVoltisonGPSSignalScreenGui.Frame.Visible = true wait(5) game.Players.LocalPlayer.PlayerGui.BelfastVoltisonGPSSignalScreenGui.Frame.Visible = false end end)
A Server Script
(Script) is, implied by it's name, run on the Server. When FilteringEnabled is on (which it is 24/7 now), the Server is restricted in some natures. Two relevant examples are LocalPlayer
and the server's access to the player's PlayerGui
When used on the server, LocalPlayer
will always return nil
. The server also cannot edit a player's PlayerGui
.
ROBLOX recently pushed an update to turn on Accurate Play Solo
(APS) by default. This replicates an ingame enviroment, and properly implements FilteringEnabled. This is why it worked before, since these restrictions do not exist when testing in studio.
There is some things we can do, such as using RemoteEvent
s and RemoteFunction
s. In this case, we will handle the Touched
event from the client.
Looked at your error and updated line 1. Add a WaitForChild.
-- Put this into a LocalScript inside StarterPlayerScripts or StarterGui local Part = game.Workspace:WaitForChild("BelfastVoltisonGPSSignal") Part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then -- checking if the BasePart that hit the part is a player game.Players.LocalPlayer.PlayerGui.BelfastVoltisonGPSSignalScreenGui.Frame.Visible = true wait(5) game.Players.LocalPlayer.PlayerGui.BelfastVoltisonGPSSignalScreenGui.Frame.Visible = false end end)