I’m having difficulty creating a script, where if you walk onto a certain part, holding an item, a GUI will pop up. Anybody able to help me?
Assuming "holding an item" means "with a tool equipped" then you can do this (putting the script in the part they walk on)
local toolname = "Sword" -- What they should be holding when stepping on the part script.Parent.Touched:connect( function(hit) if hit.Parent then local player = Game.Players:GetPlayerFromCharacter(hit.Parent) if player then if player.Character:FindFirstChild(toolname) then -- make the GUI show -- try putting the GUI you want to show up in ReplicatedStorage then inserting it into the player's PlayerGui here end end end end)
Try this
function onTouch() Tool = game.Starterpack.Toolname --Change toolname to the name of the tool if Tool.Equipped == true then if Player.Touched == true then if guiname.Visible == false then -- replace guiname with the name of the gui wait(0.5) guiname.Visible = true end onTouch:connect end onTouch()
Locked by FearMeIAmLag and BlueTaslem
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?