Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Gui Script Help?

so i tried making a script so that when you touch a specific block, a gui appears.(im new to scripting). I've tried a ton of stuff but it dosent seem to be working

local stand = game.Workspace.swordstand local player = game.Players.GetPlayers() wait(2) player.PlayerGui.ScreenGui.Kokirisword.Visible = false function onTouch(part) player.PlayerGui.ScreenGui.Kokirisword.Visible = true wait(4) player.PlayerGui.ScreenGui.Kokirisword.Visible = false end

stand.Touched:connect(onTouch)

Anyone know how to fix this?

thanks

1 answer

Put this in the 'swordstand' part.

local part = script.Parent
local debounce = true

part.Touched:connect(function(hit)
	if game.Players:FindFirstChild(hit.Parent.Name) and Workspace:FindFirstChild(hit.Parent.Name).Humanoid and debounce then debounce = false
		local player = game.Players[hit.Parent.Name]
		player.PlayerGui.ScreenGui.Kokirisword.Visible = true
		wait(4)
		player.PlayerGui.ScreenGui.Kokirisword.Visible = false
		debounce = true
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.