I've spent a few hours looking it over, trying all the ways I could think of to fix it. I just stopped getting error messages, however the script is still failing. I've tried to find the issue using the print() function but I still can't seem to find it. (Sorry about the ugly code, I just started learning because of the quarantine)
local boundkey1 = "f"
local usingPower = game.ReplicatedStorage.powerValues.usingPower
local xp = game.ReplicatedStorage.powerValues.XP
local Player = game.Players.LocalPlayer
local UIS = game:GetService("UserInputService")
UIS.InputBegan:connect(function(InputObject,Processed)
if not Processed and usingPower == false then
if InputObject.KeyCode == Enum.KeyCode.boundkey1 then
usingPower = true; xp = xp - 40
Player.Character.Humanoid.DisplayDistanceType = "None"
for _, v in pairs (Player.Character:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = .97
end
end
end
end
wait(30)
Player.Character.Humanoid.DisplayDistanceType = "Viewer"
v:IsA("BasePart") then
v.Transparency = 0; usingPower = false
end
end
end)
----------------------------------------------------------------------------------------------------------------------
UIS.InputBegan:connect(function(InputObject,Processed)
if not Processed and usingPower == true then
if InputObject.KeyCode == Enum.KeyCode.boundkey1 then
usingPower = false
for _, v in pairs (Player.Character:GetChildren()) do
if v:IsA("BasePart") then
v.Transparency = 0
end
end
end
end)

2 comments
Are you using a localscript? UserInputService only works on the client.
... that would make sense.... Don't know how I didn't see that