Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Script worked fine two weeks ago, doesn't work at all now?

Asked by 5 years ago

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)
0
Computer apparently only copy-pasted the visible text. 'Frame.Visible' should be after 'Fr' sesamert16 31 — 5y
0
Check output for errors. If there are none it's either working or not running. Print something on line 1 to see if it is. If it's not running it's either disabled or misplaced. Check the wiki for script types to see where they can run. gullet 471 — 5y
0
Any error? GetGlobals 343 — 5y
0
The error says sesamert16 31 — 5y
View all comments (4 more)
0
Sorry pressed enter instead of ". The error says "BelfastVoltisonGPSSignal is not a valid member of Workspace" even though it totally is. sesamert16 31 — 5y
0
maybe roblox got a new update and changed a lot of stuff. Lots of my scripts got broken from roblox forcing FE User#22788 5 — 5y
0
I doubt filteringenabled would break something like this, though. are you sure nothing's removing BelfastVoltisonGPSSignal? Check it's there after the error comes. 0x5FE6EB50C7B537A9 0 — 5y
0
BelfastVoltisonGPSSignal is still there. It got shortened to "Belfast..." when I started playing, but it still exists and it is still in the right spot. sesamert16 31 — 5y

1 answer

Log in to vote
0
Answered by
green271 635 Moderation Voter
5 years ago
Edited 5 years ago

Server Scripts

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.

Why did it work before?

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.

What do I do?

There is some things we can do, such as using RemoteEvents and RemoteFunctions. In this case, we will handle the Touched event from the client.

Edit

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)
0
I still get the error "BelfastVoltisonGPSSignal is not a valid member of Workspace" even though I went into the part's properties, copy-pasted the part's name into the script, and made sure the part's parent was in fact Workspace. ????? sesamert16 31 — 5y
0
Then "BelfastVoltisonGPSSignal" does not exist green271 635 — 5y
0
It does exist. I can access it and its properties after the game loads. Blue appears around it when I select it and everything sesamert16 31 — 5y
0
Hm. Are you sure this is all of it? WaitForChild pauses the script until it finds it green271 635 — 5y
0
I didn't see your edit about WaitForChild until you said that. That did the trick. Thanks! sesamert16 31 — 5y
Ad

Answer this question