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

Why is my script only checking the first event? (Unable to fix)

Asked by 5 years ago
Edited 5 years ago

Code:

local button = script.Parent
local Cam = workspace.Camera
local itemcam = workspace:WaitForChild('Shop').Cams.Cam
local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild('PlayerGui')
local Input = game:GetService('UserInputService')
local Current_Tool = player:WaitForChild('Backpack').Current_Tool
local BuyStick = game.ReplicatedStorage:WaitForChild("RemoteEvents").Shop.Buy_Stick
---


button.Activated:Connect(function()
        local ScreenGui = Instance.new('ScreenGui',PlayerGui)
        ScreenGui.Name = 'Shop_UI'
        local Frame = Instance.new('Frame',ScreenGui)
        local   Buy_Button = Instance.new('TextButton',ScreenGui)
                Buy_Button.Name = 'Buy_Button'
        Frame.Size = UDim2.new(0, 1920,0, 1079)
        Frame.Position = UDim2.new(0, 0,0, 0)
        Frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
        Frame.BackgroundTransparency = 1
        Frame.BackgroundColor3 = Color3.fromRGB(255, 229, 124)
        --Fade
        for i = 1,20 do
                Frame.BackgroundTransparency = Frame.BackgroundTransparency -0.05
                wait(0.01)
        end

        repeat wait()
        Cam.CameraType = Enum.CameraType.Scriptable
until Cam.CameraType == Enum.CameraType.Scriptable
        Cam.CFrame = itemcam.CFrame
        wait(0.5)
                for i = 1,20 do
                Frame.BackgroundTransparency = Frame.BackgroundTransparency +0.05
                wait(0.01)
                end
                        Buy_Button.Name = 'Buy_Button'
                        Buy_Button.Font = Enum.Font.Cartoon
                        Buy_Button.TextScaled = true
                        Buy_Button.Text = 'Buy'
                        Buy_Button.BorderSizePixel = 3
                        Buy_Button.BorderColor3 = Color3.fromRGB(255,255,255)
                                                Buy_Button.BackgroundColor3 = Color3.fromRGB(106, 209, 132)

                        if Input.TouchEnabled == true then --Player On Phone
                                Buy_Button.Size = UDim2.new(0, 78,0, 30)
                                Buy_Button.Position = UDim2.new(0.43, 0,0.841, 0)
                        elseif Input.KeyboardEnabled == true then
                                Buy_Button.Size = UDim2.new(0, 234,0, 90)
                                Buy_Button.Position = UDim2.new(0.42, 0,0.848, 0)
                                                                Current_Tool.Value = 'Stick'
end
---
button.MouseEnter:Connect(function()
        print("HOVERED")
        button.ImageColor3 = Color3.fromRGB(255, 222, 121)
        for i = 1,5 do
                button.Rotation = button.Rotation +2
                wait(0.01)
        end

                for i = 1,5 do
                button.Rotation = button.Rotation -2
                wait(0.01)
                end
                                for i = 1,5 do
                button.Rotation = button.Rotation +2
                wait(0.01)
                                end
                                                                for i = 1,5 do
                button.Rotation = button.Rotation -2
                wait(0.01)
                button.ImageColor3 = Color3.fromRGB(255, 255, 255)


Buy_Button.Activated:Connect(function()
BuyStick:FireServer()
end)
        end
                end)
                        end)
0
Paste your code here buddy. VitroxVox 884 — 5y
0
I already had it in pastebin but i'll do it Freddan2006YT 88 — 5y
0
Could be a wait() somewhere not allowing your other function to connect? royaltoe 5144 — 5y
0
After i click the button it can check if the mouse hovered. Freddan2006YT 88 — 5y
View all comments (6 more)
0
so what's not working exactly? are the events both firing? royaltoe 5144 — 5y
0
It dosen't check if the mouse is hovering. (That's the problem) Freddan2006YT 88 — 5y
0
but you just said it checks if the mouse is hovering...? royaltoe 5144 — 5y
0
try removing anything to do with wait() in your code temporarily. we can boil down the issue so we know it is/ isn't that royaltoe 5144 — 5y
0
try removing anything to do with wait() in your code temporarily. we can boil down the issue so we know it is/ isn't that royaltoe 5144 — 5y
0
Nope tried it did not work Freddan2006YT 88 — 5y

Answer this question