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

GUI isn't doing what the scripts says?

Asked by 9 years ago

I have two scripts that where when you hover your mouse over something, it pops a gui, when you click that gui, it's supposed to make a sound. But when I click it, it just moves the gui up.

Here are the two scripts,

Script1 (Interact1)

local Plyr = game.Players.LocalPlayer
local Mouse = Plyr:GetMouse()
local Object = game.Workspace.Interact1
local int = script.MouseGUI.TextButton
while true do
if Mouse.Target == Object then
int.Position = UDim2.new(-0.02,Mouse.X,-0.05,Mouse.Y)
elseif Mouse.Target ~= Object then
wait()
int.Position= UDim2.new(0,-500,0,0)
end
wait()
end

Script 2 (LocalScript)

local object = game.Workspace.Interact1
local int = script.Parent
while true do
int.MouseButton1Click:connect(function()
    object.Sound:Play()
    wait(0.70499999999999997)
    object.Sound:Play()
    wait(0.70499999999999997)
    object.Sound:Play()
end)
wait()
end

All the parents go down like this: Interact1.MouseGUI.TextButton.LocalScript

When I have my mouse over the part it looks like this: (This is a first person game) http://i.imgur.com/NvMqbcD.png

When I click: http://i.imgur.com/UWOncX9.png

Can someone help me with this?

Answer this question