#Access PlayerScripts through StarterGui
79 messages · Page 1 of 1 (latest)
local gui = script.Parent.Parent
local detector = gui.Text1Frame.Text1
local plr = game.Players
detector.MouseButton1Click:Connect(function(player)
local leverPlayed = player.PlayerScripts:WaitForChild("leverPlayed")
local neutralizerPlayed = player.PlayerScripts:WaitForChild("neutralizerPlayed")
local bothPlayed = player.PlayerScripts:WaitForChild("bothPlayed")
end)
if leverPlayed.Value == false and neutralizerPlayed.Value == false and bothPlayed.Value == false then
gui.Text3Frame.Visible = true
gui.Text2Frame.Visible = false
end
sry I went to have dinner
are you trying to access StarterPlayerScripts
no
I need to access the BoolValue (from the Explorer in this picture) in each players
try to make it player.PlayerGui instead, like basically put the boolean values in StarterGui
im not sure if it's possible to access starterplayerscripts or not
but im sure that'll fix your problem of not being able to access the boolean values
Doesn't work either :/
did you place the boolean values in startergui
yes
Wait actually
Let me find a tutorial system video first
So maybe I can follow that video
brb
local gui = script.Parent.Parent
local detector = gui.Text1Frame.Text1
local plr = game.Players.LocalPlayer
detector.MouseButton1Click:Connect(function(player)
local leverPlayed = player.PlayerGui:WaitForChild("leverPlayed")
local neutralizerPlayed = PlayerGui.PlayerScripts:WaitForChild("neutralizerPlayed")
local bothPlayed = player.PlayerGui:WaitForChild("bothPlayed")
end)
if leverPlayed.Value == false and neutralizerPlayed.Value == false and bothPlayed.Value == false then
gui.Text3Frame.Visible = true
gui.Text2Frame.Visible = false
end
this should fix your problem
remember to put the boolean values in startergui
and everything should work
yeah I did that
local gui = script.Parent.Parent
local detector = gui.Text1Frame.Text1
local plr = game.Players.LocalPlayer
detector.MouseButton1Click:Connect(function(player)
local leverPlayed = player.PlayerGui:WaitForChild("leverPlayed")
local neutralizerPlayed = PlayerGui.PlayerScripts:WaitForChild("neutralizerPlayed")
local bothPlayed = player.PlayerGui:WaitForChild("bothPlayed")
end)
if leverPlayed.Value == false and neutralizerPlayed.Value == false and bothPlayed.Value == false then
gui.Text3Frame.Visible = true
gui.Text2Frame.Visible = false
end
i meant that for john
ok
@wild night
yeah it should work
yeah no it doesn't :(
np
send a screenshot of startergui
what line of it is broken
and then send the error
it should say which line is causing the issue
Uh
local leverPlayed = player.PlayerGui:WaitForChild("leverPlayed")
local neutralizerPlayed = PlayerGui.PlayerScripts:WaitForChild("neutralizerPlayed")
local bothPlayed = player.PlayerGui:WaitForChild("bothPlayed")
These lines
Cuz
It said
DialogueChangeHandler attempted to index nil with 'PlayerGui'
local gui = script.Parent.Parent
local detector = gui.Text1Frame.Text1
local plr = game.Players.LocalPlayer
detector.MouseButton1Click:Connect(function(player)
local leverPlayed = player.PlayerGui:WaitForChild("leverPlayed")
local neutralizerPlayed = PlayerGui.PlayerScripts:WaitForChild("neutralizerPlayed")
local bothPlayed = player.PlayerGui:WaitForChild("bothPlayed")
end)
if leverPlayed.Value == false and neutralizerPlayed.Value == false and bothPlayed.Value == false then
gui.Text3Frame.Visible = true
gui.Text2Frame.Visible = false
end
I gotta rotate to bed now so I'll come back tmr
cya
alright
game.Players.LocalPlayer.PlayerScripts
local gui = script.Parent.Parent
local detector = gui.Text1Frame.Text1
local plr = game.Players.LocalPlayer
detector.MouseButton1Click:Connect(function(player)
local leverPlayed = player.PlayerGui:WaitForChild("leverPlayed")
local neutralizerPlayed = player.PlayerGui:WaitForChild("neutralizerPlayed")
local bothPlayed = player.PlayerGui:WaitForChild("bothPlayed")
end)
if leverPlayed.Value == false and neutralizerPlayed.Value == false and bothPlayed.Value == false then
gui.Text3Frame.Visible = true
gui.Text2Frame.Visible = false
end
this should make it work
if you want to change it back to playerscripts do
local gui = script.Parent.Parent
local detector = gui.Text1Frame.Text1
local plr = game.Players.LocalPlayer
detector.MouseButton1Click:Connect(function(player)
local leverPlayed = player.PlayerScripts:WaitForChild("leverPlayed")
local neutralizerPlayed = player.PlayerScripts.PlayerGui:WaitForChild("neutralizerPlayed")
local bothPlayed = player.PlayerScripts:WaitForChild("bothPlayed")
end)
if leverPlayed.Value == false and neutralizerPlayed.Value == false and bothPlayed.Value == false then
gui.Text3Frame.Visible = true
gui.Text2Frame.Visible = false
end
i also realized the reason it didn't work in the first place was because you didn't reference the localplayer
so a single line would've fixed this problem from the start
mb anyways
also you forgot a player. on line 8
didn't see that at all tyyy
Ok
So
There’s absolutely no use for the plr
The only thing I used is player which is an argument in the MouseButton1Click thing
only the local player can click on their gui 👍
