Text is not becoming visible

Text is not becoming visible when TextTransparency is 1 and when you click on model it must be 0, in fact it don’t give any badge (it must)
Scripts:

-- script where text must be visible
function onClicked()
local Text = game.Workspace.Laptop.screen.SurfaceGui.TextLabel
Text.TextTransparency = 0
wait(5)
	onClicked.Character:findFirstChild("Humanoid")
	script.Parent.ClickDetector.MouseClick:Connect(function(player)
		player:Kick("you just wasted your time coming there")
	end)
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)
-- badge awarder script
print("Badge Awarder Loaded. BadgeID: " .. script.Parent.BadgeID.Value)

function OnClick(part)
	if (part.Parent:FindFirstChild("Humanoid") ~= nil) then
		local p = game.Players:GetPlayerFromCharacter(part.Parent)
		if (p ~= nil) then
			print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. p.userId)
			local b = game:GetService("BadgeService")
			b:AwardBadge(p.userId, script.Parent.BadgeID.Value)
		end
	end
end

script.Parent.ClickDetector.Clicked:connect(OnClick)

Explorer:
изображение_2022-05-08_152451432

well is surfacegui in a part or not

wouldn’t
part
be the player in

function OnClick(part)

so this:

function OnClick(part)
	if (part.Parent:FindFirstChild("Humanoid") ~= nil) then
		local p = game.Players:GetPlayerFromCharacter(part.Parent)

should be:

function OnClick(p)

https://developer.roblox.com/en-us/api-reference/class/ClickDetector

in a part
image

i need to change from part to p ?

yeah, and remove the checks for if the player exists

this good?

print("Badge Awarder Loaded. BadgeID: " .. script.Parent.BadgeID.Value)

function OnClick(p)
	if (p.Parent:FindFirstChild("Humanoid") ~= nil) then
		local p = game.Players:GetPlayerFromCharacter(p.Parent)
		if (p ~= nil) then
			print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. p.userId)
			local b = game:GetService("BadgeService")
			b:AwardBadge(p.userId, script.Parent.BadgeID.Value)
		end
	end
end

script.Parent.ClickDetector.Clicked:connect(OnClick)
print("Badge Awarder Loaded. BadgeID: " .. script.Parent.BadgeID.Value)

function OnClick(p)
			print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. p.userId)
			local b = game:GetService("BadgeService")
			b:AwardBadge(p.userId, script.Parent.BadgeID.Value)
end

script.Parent.ClickDetector.Clicked:connect(OnClick)

Does that work, shouldnt that be MouseClick

what about this btw

function onClicked()
local Text = game.Workspace.Laptop.Screen.SurfaceGui.TextLabel
Text.TextTransparency = 0
wait(5)
	onClicked.Character:findFirstChild("Humanoid")
	script.Parent.ClickDetector.MouseClick:Connect(function(player)
		player:Kick("you just wasted your time coming there")
	end)
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

No, it should be what @SeargentAUS said

its another script bruh, read two scripts

Mouseclick doesn’t work as well on mobile devices. It does work, just is a bit more inconveniennt

1 Like

should work.

findFirstChild mightt have to be FindFirstChild

function onClicked()
local Text = game.Workspace.Laptop.Screen.SurfaceGui.TextLabel
Text.TextTransparency = 0
wait(5)
	onClicked.Character:FindFirstChild("Humanoid")
	script.Parent.ClickDetector.Clicked:Connect(function(player)
		player:Kick("you just wasted your time coming there")
	end)
end

script.Parent.ClickDetector.Clicked:connect(onClicked)

this?

yeah? test it out

…/././/././

@SeargentAUS this still dont work, new scripts is:

print("Badge Awarder Loaded. BadgeID: " .. script.Parent.BadgeID.Value)

function OnClick(p)
	print("Awarding BadgeID: " ..script.Parent.BadgeID.Value .. " to UserID: " .. p.userId)
	local b = game:GetService("BadgeService")
	b:AwardBadge(p.userId, script.Parent.BadgeID.Value)
end

script.Parent.ClickDetector.Clicked:connect(OnClick)
function onClicked()
	local Text = game.Workspace.Laptop.Screen.SurfaceGui.TextLabel
	Text.TextTransparency = 0
	wait(5)
	onClicked.Character:FindFirstChild("Humanoid")
	script.Parent.ClickDetector.Clicked:Connect(function(player)
		player:Kick("you just wasted your time coming there")
	end)
end

script.Parent.ClickDetector.Clicked:connect(onClicked)

maybe

Text.Transparency = 0

Ok well it’s still wrong either way, you are setting up another click listener inside of the function that happens when you click

function onClicked(player)
	local Text = game.Workspace.Laptop.Screen.SurfaceGui.TextLabel
	Text.TextTransparency = 0
	wait(5)
	player:Kick("you just wasted your time coming there")
end

script.Parent.ClickDetector.Clicked:connect(onClicked)

What errors are occuring