Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Mouse over text with pickup on the mouse target object?

Asked by 2 years ago

I made a mouse over text and if you dont know what that is its basically a text following the mouse when you hover into an chosen object, but back to the question I made a user input service function that works when the textlabel that follows the mouse is visible and if the text of the textlabel is the same with the mouse target stringvalue.value, but its not working, please help me thank you

the script:

local player = game.Players.LocalPlayer
local playergui = player:WaitForChild("PlayerGui")
local UIS = game:GetService("UserInputService")
local tweenservice = game:GetService("TweenService")

local tweeninfoo = TweenInfo.new(2,Enum.EasingStyle.Sine,Enum.EasingDirection.Out,0,true,1)

local goal = {TextTransparency = 1}

local tween = tweenservice:Create(playergui.ItemPickup.TextLabel, tweeninfoo, goal) 

UIS.InputBegan:Connect(function(input, gameProcessed)
    if input.UserInputType == Enum.KeyCode.E and playergui.MouseOverText.Textlabel.Visible == true and playergui.MouseOverText.Textlabel.Text == "Flashlight" then
        playergui.ItemPickup.TextLabel.Text = script.Parent.MouseoverText.Value
        tween:Play()
        script.Parent:Destroy()
    end
end)

dont mind the tween service i made that so when the item got picked up it tweens in a text saying the objects name

Answer this question