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

Script that makes a GUI pop up when you touch a part isn't working, why?

Asked by 6 years ago

So what this script is supposed to do is make a GUI pop up when a part is touched. It isn't working, why? Here is my script:

local Part = script.Parent

Part.Touched:connect(function(HIT)
 local H = HIT.Parent:FindFirstChild("Humanoid")
 if H then
  local Player = game.Players:GetPlayerFromCharacter(HIT.Parent)
  Player.PlayerGui.ScreenGui.Frame.Visible = true
 end
end)?
0
Few things, maybe local part = not enough Parent. Line 4, local H = "HIT" that is not something that would work. It either needs to be touched or some other code name. Also, Line 3, Part.OnTouched:connect(funtion(), -OnTouched means when player touches the part or brick. Also, if H then, makes no sense, HIT.Parent:FindFirstChild("Humanoid"), is not explaining what it is doing, it's just saying ... Khornos 0 — 6y
0
... that it's finding the player that touches it. You want to have all your local blahblah = script.Parent, at the top, and then your function and if and true in a body. Pretty much your script is all mess up. Wherever you got that script from just delete it. Do something like, Parent. [[workspace]] Partlol. [[the brick inside workspace]] OnTouched:connect(function() [[no need for hit]] Khornos 0 — 6y

Answer this question