I made an ability chooser, and when you choose something, it changes a numbervalue to a certain number, which it does, and the script is supposed to change what happens when you press Q because of this value, but it doesn't change at all. Help would be nice.
local pow = game.Players.LocalPlayer:WaitForChild("PlayerGui"):WaitForChild("PowerGui2"):WaitForChild("Frame")
local ability = pow.Power.Value
local plr = game.Players.LocalPlayer.Character
local UIS = game:GetService("UserInputService")
UIS.InputBegan:Connect(function(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.Q and ability == 1 then
game.ReplicatedStorage.Speedparticle:Clone().Parent = game.Players.LocalPlayer.Character:FindFirstChild("UpperTorso")
game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").WalkSpeed = 40
wait(10)
game.Players.LocalPlayer.Character:FindFirstChild("UpperTorso").Speedparticle:Remove()
game.Players.LocalPlayer.Character:FindFirstChild("Humanoid").WalkSpeed = 16
end
local RS = game:GetService("ReplicatedStorage")
local remoteEvent = RS:WaitForChild("RemoteEvent")
UIS.InputBegan:Connect(function(inputObject, gameProcessed)
if inputObject.KeyCode == Enum.KeyCode.Q and ability ==2 then
remoteEvent:FireServer() --Nothing passed to the server
wait(0.5)
for i, Child in pairs(plr:getChildren()) do
if Child:IsA('Part') or Child:IsA('MeshPart') or Child:IsA('Accessory') then
Child.Transparency = 0.5
end
end
plr:FindFirstChild("Head").face.Transparency = 0.5
plr:FindFirstChild("HumanoidRootPart").Transparency = 1
wait(9.5)
for i, Child in pairs(plr:getChildren()) do
if Child:IsA('Part') or Child:IsA('MeshPart') or Child:IsA('Accessory') then
Child.Transparency = 0
end
end
plr:FindFirstChild("Head").face.Transparency = 0
plr:FindFirstChild("HumanoidRootPart").Transparency = 1
end
end)

1 comment
I changed my question a bit but that was the problem and you fixed it! Thanks!