how would I find TutorialGui as a variable as it is no longer script.parent?
UI Input events need to be on the client, youâll need to have another LocalScript and reference it there.
if i create a different local script and find it from there, variables donât transfer from scripts. How would I find variables from another script?
Youâd manually transfer them with a remote event from Client to Server
How do I use remote events? is there something that explains how to use it? Iâm fairly new so Iâm not familiar with all of the events and functions in luau
Wat ya needa do is have one LocalScript and one Script, the Script checcs if the Player is new to the game and if they are, enables the TutorialGui. The LocalScript then checcs to see if the TutorialGui is enabled, by way of a loop perhaps. This should be the most simple solution that disregards the need for direct client to server communications. This is all ya needa know to achieve wat ya want to do, so please figure it out as thatâs the greatest way to learn.
I understand, but in the script I canât enable TutorialGui because you can assign a screengui as a variable in a script.
Assumin that the ScreenGui TutorialGui is in StarterGui, all ya needa do in the Script is wait for it to be parented to PlayerGui, this can be done in the PlayerAdded event
local TutorialGui = Player:WaitForChild("PlayerGui"):WaitForChild("TutorialGui")
I tried that, but for some reason I canât assign Player. The normal way I would do it: local player = game.players.LocalPlayer
but for some reason that doesnât work on this script.
Thatâs because LocalScripts run exclusively on the client, so there is only one target player.
The property Players.LocalPlayer doesnât exist on the server because of this, the server does not run code exclusively for any client unless directed to. Therefore Player in this case is retrieved from the parameter passed in Players.PlayerAdded
local Player = game.Players.PlayerAdded
local TutorialGui = Player:WaitForChild("PlayerGui"):WaitForChild("TutorialGui")
local TutorialFrame = TutorialGui:WaitForChild("TutorialFrame")
local YesButton = TutorialFrame:WaitForChild("Yes")
local NoButton = TutorialFrame:WaitForChild("No")
WaitForChild is not a valid member of RBXScriptSignal - Server - Script:2
Not quite, though close. Youâre referencin the event there, not connectin to it, below is the correct code
game:GetService("Players").PlayerAdded:Connect(Player)
local TutorialGui = Player:WaitForChild("PlayerGui")
:WaitForChild("TutorialGui")
local TutorialFrame = TutorialGui:WaitForChild("TutorialFrame")
local YesButton = TutorialFrame:WaitForChild("Yes")
local NoButton = TutorialFrame:WaitForChild("No")
end
local Player = game.Players.PlayerAdded
game:GetService("Players").PlayerAdded:Connect(Player)
local TutorialGui = Player:WaitForChild("PlayerGui"):WaitForChild("TutorialGui")
local TutorialFrame = TutorialGui:WaitForChild("TutorialFrame")
local YesButton = TutorialFrame:WaitForChild("Yes")
local NoButton = TutorialFrame:WaitForChild("No")
end
local TutorialGui = Player:WaitForChild("PlayerGui"):WaitForChild("TutorialGui")
local TutorialFrame = TutorialGui:WaitForChild("TutorialFrame")
local YesButton = TutorialFrame:WaitForChild("Yes")
local NoButton = TutorialFrame:WaitForChild("No")
local ds = game:GetService('DataStoreService'):GetDataStore(game.PlaceId..'dataStoreNameNOJ')
local numberOfJoins = 0
local TutorialGui = script.Parent
local TutorialFrame = TutorialGui:WaitForChild("TutorialFrame")
local YesButton = TutorialFrame:WaitForChild("Yes")
local NoButton = TutorialFrame:WaitForChild("No")
this isnât working
Remove the local Player = game.Players.PlayerAdded
and the repeat declares and put the rest of the code in the PlayerAdded event and add a ) to the end in short here ya go
game:GetService("Players").PlayerAdded:Connect(Player)
local TutorialGui = Player:WaitForChild("PlayerGui")
:WaitForChild("TutorialGui")
local TutorialFrame = TutorialGui:WaitForChild("TutorialFrame")
local YesButton = TutorialFrame:WaitForChild("Yes")
local NoButton = TutorialFrame:WaitForChild("No")
local ds = game:GetService('DataStoreService')
:GetDataStore(game.PlaceId..'dataStoreNameNOJ')
local numberOfJoins = 0
end)
game:GetService("Players").PlayerAdded:Connect(Player)
local TutorialGui = Player:WaitForChild("PlayerGui")
:WaitForChild("TutorialGui")
local TutorialFrame = TutorialGui:WaitForChild("TutorialFrame")
local YesButton = TutorialFrame:WaitForChild("Yes")
local NoButton = TutorialFrame:WaitForChild("No")
local ds = game:GetService('DataStoreService')
:GetDataStore(game.PlaceId..'dataStoreNameNOJ')
local numberOfJoins = 0
end)