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

Quest System Not Functioning at all no errors at all ?

Okay so i have a glowing yellow brick and if u touch it a frame should like pop up just like quests are made right look

script.Parent.Touched:connect(function(hit)
	game.StarterGui.ScreenGui.Frame.Visible = false
	game.StarterGui.Successpartone.Frame.Visible = true
end)

2 answers

✓ Accepted answer

Your current attempt does not work because you are trying to access the player's GUI through the StarterGui. You need access it through PlayerGui, which is parented under the Player instance.

In your Touched event, you need to check if the part touching belongs to the player's character. We can use the Players:GetPlayerFromCharacter() function to get the player that is touching the part. It returns the corresponding player instance or nil if it cannot find the player from the character. From here, we can access the player's PlayerGui.

--Get the player service.
local PS = game:GetService("Players")

script.Parent.Touched:Connect(function(hit)
	--Get the player from the character.
	local Player = PS:GetPlayerFromCharacter(hit.Parent)
	--If the player exists then change the visibility of the player's gui.
	if Player then
		Player.PlayerGui.ScreenGui.Frame.Visible = false
		Player.PlayerGui.Successpartone.Frame.Visible = true
	end
end)

Make sure it is a Script and not a LocalScript. Parent it under the brick.

Please accept the answer if this helps.

3 comments

0

Im sorry it did not work here what the output said: 08:49:42.598 - ScreenGui is not a valid member of PlayerGui 08:49:42.600 - Stack Begin 08:49:42.601 - Script 'Workspace.Part.Script', Line 9 08:49:42.601 - Stack End 08:49:42.712 - ScreenGui is not a valid member of PlayerGui 08:49:42.714 - Stack Begin 08:49:42.714 - Script 'Workspace.Part.Script', Line 9 08:49:42.715 - Stack End

0

i cecked it and it was there why isent it working ..anyways just ave the check :/

0

Well that error occurs when ScreenGui is not in the PlayerGui. Is the gui named ScreenGui? Does it exist when the player touches the part? If you are sure it is there then maybe you can use Player.PlayerGui:WaitForChild("ScreenGui").Frame.Visible = false instead.

u have to get the gui trough the player

local plr = game:GetService("Players").LocalPlayer
game.workspace.part.Touched:Connect(function(hit) -- dont usee :connect its deprecated
	    plr.PlayerGui.ScreenGui.Frame.Visible = false
	    plr.PlayerGui.Successpartone.Frame.Visible = true
	end)

5 comments

0

thank you my man ill test it

0

Put the screen guis were?

0

Not Working at all

0

If the part is in workspace and a localscript is parented to the part, it won’t run. You need to use GetPlayerFromCharacter.

0

how would i do that?

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