Just so you know sending a remote event to the server is in no way necessary, this code should be handled via the client for well its just better that way performance wise and for the sake of not doing things unnecessary
I was thinking the server will handle when the part is touched, then send a remote event to the client which will set the GUI visible to true
Yeah that would work but its best to just handle it via the client
Okay, you likely know better than i do. Ive personally never handled a part touch like that through the client, but if it works it works
its ok, weâve all been there (I probably would have made it that way in the past gonna be real with you!)
I just like spreading the good word so no one has to make these mistakes and just make their code better! : D
Definitely! Its always good to learn new and better ways to make your code
I still have a problem, nothing works and I donât have any errors to guide me to know where I went wrong, the documentation also doesnât give me any clues to the gui, only separately and I know it works a little differently
can you show us your code?
Thanks!
local AbilityList = game.Players.LocalPlayer.PlayerGui.WaitForChild("GuiAbilities")
local TouchPart = workspace.Obby.SelectAbilityRing.Part
TouchPart.Touched:Connect(function(part)
if (part.Parent:FindFirstChildWhichIsA("Humanoid")) then
local player = game.Players.GetPlayerFromCharacter(part.Parent)
AbilityList.Enabled = true
print("Work")
end
end)
So I see a problem with your code, and its ok its a common mistake, basically you are doing this:
.WaitForChild("GuiAbilities")
Now WaitForChild()
isnt a property so we need to use a different symbol, instead of a .
, we need to use this :
.
Try this:
local AbilityList = game.Players.LocalPlayer.PlayerGui:WaitForChild("GuiAbilities")
Would be helpful to know so we can help you out better.
itâs the first time I make this mistake, lol, but it still doesnât work, the local script is placed in part, I hope that this information can somehow affect my script
@Herbz_Dev2106 Herbz_Dev2106 sorry for not answering you, I was focused on seeing where I am wrong
Yeah I am just curious, since Iâve never accessed PlayerGui directly before. So the object is where before the game starts?
Ok so first, take the current script you have (dont change the code), make sure it is a local script. parent it to StarterPlayerScripts, local scripts cant run when parented to the workspace so this should work
I put that local script in StarterPlayerScript and it still doesnât work
Ok can you do all of the following
- A: Take a screenshot of your workspace so we can see where everything is parented
- B: Show us the code
- C: Get me some food
These would help a lot so we can help determine the problem
Maybe your not accessing âGuiAbilitesâ correctly; thatâs why I keep asking the question. Would be helpful if you answered.
local AbilityList = game.Players.LocalPlayer.PlayerGui:WaitForChild("GuiAbilities")
local TouchPart = workspace.Obby.SelectAbilityRing.Part
TouchPart.Touched:Connect(function(part)
if (part.Parent:FindFirstChildWhichIsA("Humanoid")) then
local player = game.Players.GetPlayerFromCharacter(part.Parent)
AbilityList.Enabled = true
print("Work")
end
end)
this is all the information I can offer
@FroDev1002 for helping me
Ok please again make the script a LOCAL SCRIPT
, then parent the script to STARTERPLAYERSCRIPTS
Can you also show in the workspace where the GUI is parented?
Assuming that âGuiAbilitesâ is a Gui that is placed in StarterGui, you should probably try and print the AbilityList variable to see if the Gui object is actually being found.