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

My UIS Input Began event isn't working? [SOLVED]

Asked by 5 years ago
Edited 5 years ago

Okay, so I made this cool script, it puts air particles around the user's body and buffs their stats. The script was a Local Script, and when I was testing with some other people, they couldn't see it when I activated it. I figured that FE was to blame, since it was a local script, so I tried making it a normal script, and now the UIS Input Began event doesn't do anything. Can UIS only be used in a local script? If so, what else can I use to substitute it?

Script:

local player = game.Players:WaitForChild(script.Parent.Parent.Name)
local char = player.Character
local humanoid = char:WaitForChild("Humanoid")
local UIS = game:GetService("UserInputService")
local enabled = script:WaitForChild("LimitBreaker")
enabled.Value = false
local enableKey = Enum.KeyCode.Q

local stats = player:WaitForChild("leaderstats")
local level = stats:WaitForChild("Level")

local staminaStuff = player:WaitForChild("StaminaStuff")
local stamina = staminaStuff:WaitForChild("Stamina")
local drain = 2

local otherStats = player:WaitForChild("Stats")

local strengthF = otherStats:WaitForChild("Strength")
local strength = strengthF:WaitForChild("StrengthLevel")

local speedF = otherStats:WaitForChild("Agility")
local speed = speedF:WaitForChild("AgilityLevel")

local jumpF = otherStats:WaitForChild("Jump")
local jump = jumpF:WaitForChild("JumpLevel")

local multiplier = 2

    UIS.InputBegan:connect(function(key)
        if key.KeyCode == enableKey then
            if level.Value >= 200 and stamina.Value>= 0 then
                if enabled.Value == false then
                    enabled.Value = true
                    strength.Value = strength.Value * multiplier
                    speed.Value = speed.Value * multiplier
                    jump.Value = jump.Value * multiplier
                    while enabled.Value == true do
                        local size = level.Value / 25 + 20
                        local airStuff = script:WaitForChild("AirStuff"):Clone()
                        local randomNumber = math.random(-3,-2)
                        local absValueRandom = math.abs(randomNumber)
                        local randomPose = Vector3.new(0,randomNumber,0)
                        airStuff.Position = char.HumanoidRootPart.Position + randomPose
                        airStuff.Parent = game.Workspace
                        airStuff.Orientation = Vector3.new(0,math.random(0,180),0)
                        airStuff.Size = Vector3.new(size,size/15,size)
                        airStuff.Transparency = 0.2

                        local airStuff2 = script:WaitForChild("AirStuff"):Clone()
                        local randomNumber2 = math.random(-3,-2)
                        local absValueRandom2 = math.abs(randomNumber2)
                        local randomPose2 = Vector3.new(0,randomNumber2,0)
                        airStuff2.Position = char.HumanoidRootPart.Position + randomPose2
                        airStuff2.Parent = game.Workspace
                        airStuff2.Orientation = Vector3.new(0,math.random(0,180),0)
                        airStuff2.Size = Vector3.new(size/2,size/30,size/2)
                        airStuff2.Transparency = 0.2

                        local airStuff3 = script:WaitForChild("AirStuff"):Clone()
                        local randomNumber3 = math.random(-3,-2)
                        local absValueRandom3 = math.abs(randomNumber3)
                        local randomPose3 = Vector3.new(0,randomNumber3,0)
                        airStuff3.Position = char.HumanoidRootPart.Position + randomPose3
                        airStuff3.Parent = game.Workspace
                        airStuff3.Orientation = Vector3.new(0,math.random(0,180),0)
                        airStuff3.Size = Vector3.new(size/3,size/45,size/3)
                        airStuff3.Transparency = 0.2

                        local airStuff4 = script:WaitForChild("AirStuff"):Clone()
                        local randomNumber4 = math.random(-3,-2)
                        local absValueRandom4 = math.abs(randomNumber4)
                        local randomPose4 = Vector3.new(0,randomNumber4,0)
                        airStuff4.Position = char.HumanoidRootPart.Position + randomPose4
                        airStuff4.Parent = game.Workspace
                        airStuff4.Orientation = Vector3.new(0,math.random(0,180),0)
                        airStuff4.Size = Vector3.new(size/4,size/60,size/4)
                        airStuff4.Transparency = 0.2

                        local airStuff5 = script:WaitForChild("AirStuff"):Clone()
                        local randomNumber5 = math.random(-3,-2)
                        local absValueRandom5 = math.abs(randomNumber5)
                        local randomPose5 = Vector3.new(0,randomNumber5,0)
                        airStuff5.Position = char.HumanoidRootPart.Position + randomPose5
                        airStuff5.Parent = game.Workspace
                        airStuff5.Orientation = Vector3.new(0,math.random(0,180),0)
                        airStuff5.Size = Vector3.new(size/5,size/75,size/5)
                        airStuff5.Transparency = 0.2

                        for i = 1,3,0.2 do
                            stamina.Value = stamina.Value - 5
                            if stamina.Value <= 0 then
                                enabled.Value = false
                                break
                            end

                            airStuff.Transparency = i/3
                            airStuff.Orientation = airStuff.Orientation + Vector3.new(0,50,0)
                            airStuff.Position = char.HumanoidRootPart.Position + randomPose

                            airStuff2.Transparency = i/3
                            airStuff2.Orientation = airStuff2.Orientation + Vector3.new(0,50,0)
                            airStuff2.Position = char.HumanoidRootPart.Position + randomPose2

                            airStuff3.Transparency = i/3
                            airStuff3.Orientation = airStuff3.Orientation + Vector3.new(0,50,0)
                            airStuff3.Position = char.HumanoidRootPart.Position + randomPose3

                            airStuff4.Transparency = i/3
                            airStuff4.Orientation = airStuff4.Orientation + Vector3.new(0,50,0)
                            airStuff4.Position = char.HumanoidRootPart.Position + randomPose4

                            airStuff5.Transparency = i/3
                            airStuff5.Orientation = airStuff5.Orientation + Vector3.new(0,50,0)
                            airStuff5.Position = char.HumanoidRootPart.Position + randomPose5
                            wait()
                        end
                        airStuff:Destroy()
                        airStuff2:Destroy()
                        airStuff3:Destroy()
                        airStuff4:Destroy()
                        airStuff5:Destroy()
                    end
                elseif enabled.Value == true then
                    speed.Value = speed.Value / multiplier
                    jump.Value = jump.Value / multiplier
                    strength.Value = strength.Value / multiplier
                    enabled.Value = false
                end
            end
        end
    end)

0
You can only use UIS on a local script. The reason why the other players can't see the effect is because you're doing it on the client. You would need to tell the server to create these effects using RemoteEvents. xPolarium 1388 — 5y
0
Well how do I use remote events? Knineteen19 307 — 5y
0
The Roblox wiki has information and even little tutorials that you can learn from. I promise if you read this you'll learn how to use them. http://wiki.roblox.com/index.php?title=Remote_Functions_%26_Events Impacthills 223 — 5y
0
Mk thanks! I guess I'll just post this as answered or something. Knineteen19 307 — 5y

Answer this question