I want to make a “notificiation” that shows up when you click the left mouse button. (For a clicker game)
What is the issue?
The script doesn’t work at all, I don’t even get any types of error messages.
What solutions have I tried so far?
Trying it with a Remote Event
Instead of position changes, i had 8 TextLabels which should randomly get visible
Asking ChatGPT
If it’s an obvious mistake, i’m very sorry. I’m a beginner : )
That’s the script:
local T = script.Parent.TextLabel
local UIS = game:GetService("UserInputService")
function getRandomNumber()
local randomIndex = math.random(1, 8)
X = randomIndex
return X
end
UIS.InputBegan:connect(function(input,gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
getRandomNumber()
local Text = T:Clone()
if X == 1 then
Text.Position = UDim2.new(-0.19, 0, 0.456, 0)
elseif X == 2 then
Text.Position = UDim2.new(-0.386, 0,0.359, 0)
elseif X == 3 then
Text.Position = UDim2.new(0.052, 0, 0.345, 0)
elseif X == 4 then
Text.Position = UDim2.new(0.094, 0, 0.608, 0)
elseif X == 5 then
Text.Position = UDim2.new(-0.201, 0, 0.19, 0)
elseif X == 6 then
Text.Position = UDim2.new(-0.419, 0, 0.116, 0)
elseif X == 7 then
Text.Position = UDim2.new(-0.401, 0, 0.602, 0)
elseif X == 8 then
Text.Position = UDim2.new(0.17, 0, 0.135, 0)
end
Text.Visible = true
wait(3)
Text.Visible = false
end
end)
Does anybody have a clue what the issue can be, or even has a better alternative?
Thanks for any help!
I already said the exact same but you didn’t listen. If that was the problem though it would be erroring, therefore the script in the event isn’t running at all
local T = script.Parent.TextLabel
local UIS = game:GetService("UserInputService")
function getRandomNumber()
local randomIndex = math.random(1, 8)
X = randomIndex
return X
end
UIS.InputBegan:connect(function(input,gameProcessedEvent)
print('one')
if input.UserInputType == Enum.UserInputType.MouseButton1 then
print('two')
local X = getRandomNumber()
local Text = T:Clone()
if X == 1 then
Text.Position = UDim2.new(-0.19, 0, 0.456, 0)
elseif X == 2 then
Text.Position = UDim2.new(-0.386, 0,0.359, 0)
elseif X == 3 then
Text.Position = UDim2.new(0.052, 0, 0.345, 0)
elseif X == 4 then
Text.Position = UDim2.new(0.094, 0, 0.608, 0)
elseif X == 5 then
Text.Position = UDim2.new(-0.201, 0, 0.19, 0)
elseif X == 6 then
Text.Position = UDim2.new(-0.419, 0, 0.116, 0)
elseif X == 7 then
Text.Position = UDim2.new(-0.401, 0, 0.602, 0)
elseif X == 8 then
Text.Position = UDim2.new(0.17, 0, 0.135, 0)
end
Text.Visible = true
wait(3)
Text.Visible = false
end
end)
local T = script.Parent.TextLabel
local UIS = game:GetService("UserInputService")
function getRandomNumber()
local randomIndex = math.random(1, 8)
X = randomIndex
return X
end
UIS.InputBegan:connect(function(input,gameProcessedEvent)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
getRandomNumber()
local Text = T:Clone()
Text.Parent = script.Parent
if X == 1 then
Text.Position = UDim2.new(-0.19, 0, 0.456, 0)
elseif X == 2 then
Text.Position = UDim2.new(-0.386, 0,0.359, 0)
elseif X == 3 then
Text.Position = UDim2.new(0.052, 0, 0.345, 0)
elseif X == 4 then
Text.Position = UDim2.new(0.094, 0, 0.608, 0)
elseif X == 5 then
Text.Position = UDim2.new(-0.201, 0, 0.19, 0)
elseif X == 6 then
Text.Position = UDim2.new(-0.419, 0, 0.116, 0)
elseif X == 7 then
Text.Position = UDim2.new(-0.401, 0, 0.602, 0)
elseif X == 8 then
Text.Position = UDim2.new(0.17, 0, 0.135, 0)
end
Text.Visible = true
wait(3)
Text.Visible = false
end
end)