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

Quest System Not Functioning at all no errors at all ?

Asked by 5 years ago

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

Log in to vote
1
Answered by
Rheines 661 Moderation Voter
5 years ago
Edited 5 years ago

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.

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 legendarycoos11 1 — 5y
0
i cecked it and it was there why isent it working ..anyways just ave the check :/ legendarycoos11 1 — 5y
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. Rheines 661 — 5y
Ad
Log in to vote
0
Answered by
tacotown2 119
5 years ago
Edited 5 years ago

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)

0
thank you my man ill test it legendarycoos11 1 — 5y
0
Put the screen guis were? legendarycoos11 1 — 5y
0
Not Working at all legendarycoos11 1 — 5y
0
If the part is in workspace and a localscript is parented to the part, it won’t run. You need to use GetPlayerFromCharacter. Rheines 661 — 5y
0
how would i do that? legendarycoos11 1 — 5y

Answer this question