I already tried that, but I put that local script back where it was originally because I thought it might help
but how, as Iâm already tired with so many errors
Well I have to go for a bit, Ill look at it again when I return. Good luck!
local AbilityList = game.Players.LocalPlayer.PlayerGui:WaitForChild("GuiAbilities")
local TouchPart = workspace.Obby.SelectAbilityRing.Part
print("AbilityList:", AbilityList)
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)
Put the line print("AbilityList:", AbilityList)
somewhere in your code thatâs not under the TouchPart
function. Tell me what the result of the print you get is.
nothing, I have the impression that it ignores my script, but it doesnât ignore other scripts, only this one with the opening of the gui
Is this the one in Workspace
, or the same one placed inside StarterPlayerScripts
that isnât working?
local script is placed in StarterPlayerScripts
Is that the same one that is using the .Touched event?
As far as I know of, the only way to use .Touched on a part inside Workspace is by using a script, so therefore you would almost certainly need to use a remote event for this, if not completely.
yes, thatâs the script I use
local AbilityList = game.Players.LocalPlayer.PlayerGui:WaitForChild("GuiAbilities")
local TouchPart = workspace.Obby.SelectAbilityRing.Part
print("AbilityList:", AbilityList)
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)
@Foxstream52, @FroDev1002 Correct me if you think I am wrong, but I think it isnât unnecessary. In fact, as far as I know of .Touched
events connected to parts inside Workspace
have to use Scripts, since its interacting with the actual model objects relating to all the physical players within the game, located inside Workspace
. So you would indeed need what @Foxstream52 said.
but how? that I donât fully understand
Detect when a part is touched using .Touched
like you have done, but inside a script which is directly in the part that you want to detect if it has been touched or not. When it gets touched, it will fire a Remote Event to the client to show the Gui to the player.
local scripts dont work in Workspace
put the script INSIDE the ui itself (to be clean) and change the path to the part in the script
local AbilityList = game.Players.LocalPlayer.PlayerGui:WaitForChild("GuiAbilities")
local TouchPart = workspace:WaitForChild("Obby").SelectAbilityRing.Part -- put a waitforchild in localscripts on the first anscestor
print("AbilityList:", AbilityList)
TouchPart.Touched:Connect(function(part)
if (part.Parent:FindFirstChildWhichIsA("Humanoid")) then
local player = game.Players.GetPlayerFromCharacter(part.Parent)
---- it'll activate if ANYONE touches the part so to fix this;
if not player == game.Players.LocalPlayer then return end
AbilityList.Enabled = true
print("Work")
end
end)
the script is put in StarterPlayerScript
still not working how can i fix this???
the script would work fine, the problem would be the ui itself at this point
You cannot put scripts inside ScreenGuis, neither can you directly put ScreenGuis inside Workspace since they will not be shown onto the playerâs screen?
are you thinking of surfaceguis?
Not sure what you meant by this: