so i wanted to change my click to get text gui to a touch to get gui one, don’t know how to do it tho
here’s the click script:
function onClick(click)
for i,v in pairs (script.Parent:GetChildren()) do
if v.ClassName == "ScreenGui" then
local c = v:Clone()
c.Parent = click.PlayerGui
end
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
function onTouched(hit)
if hit and hit.Parent then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("ScreenGui") then
local c = v:Clone()
c.Parent = player.PlayerGui
end
end
end
end
end
script.Parent.Touched:Connect(onTouched)
function onTouched(hit)
if hit and hit.Parent then
local debounce = false
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
wait (20)
local debounce = true
if player then
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("ScreenGui") then
local c = v:Clone()
c.Parent = player.PlayerGui
end
end
end
end
end
script.Parent.Touched:Connect(onTouched)
well i only like want it to do like the tutorial of a tycoon game or something wheer you touch it and a typewriter gui pops up and stuff
(i only want it to appear once)
local debounce = false
function onTouched(hit)
if hit and hit.Parent then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player and not debounce then
debounce = true
for i, v in pairs(script.Parent:GetChildren()) do
if v:IsA("ScreenGui") then
local c = v:Clone()
c.Parent = player.PlayerGui
end
end
wait(20)
debounce = false
end
end
end
script.Parent.Touched:Connect(onTouched
-- i added debounce since i read previous replies
local deb = false
function onTouched(hit)
if deb then return end
deb = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local v = script.Parent:FindFirstChildOfClass('ScreenGui')
if not v then return end -- returns if it doesn't exist
local c = v:Clone()
c.Parent = player:WaitForChild('PlayerGui')
end
wait(20)
deb = false
end
script.Parent.Touched:Connect(onTouched)