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

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

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)

8 comments

0

Computer apparently only copy-pasted the visible text. 'Frame.Visible' should be after 'Fr'

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.

0

Any error?

0

The error says

0

Sorry pressed enter instead of ". The error says "BelfastVoltisonGPSSignal is not a valid member of Workspace" even though it totally is.

0

maybe roblox got a new update and changed a lot of stuff. Lots of my scripts got broken from roblox forcing FE

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.

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.

1 answer

✓ Accepted answer

###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)

5 comments

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. ?????

0

Then "BelfastVoltisonGPSSignal" does not exist

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

0

Hm. Are you sure this is all of it? WaitForChild pauses the script until it finds it

0

I didn't see your edit about WaitForChild until you said that. That did the trick. Thanks!

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