Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can't find the Error within my code, even after using print(), can anyone show me the error?

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

0

Are you using a localscript? UserInputService only works on the client.

0

... that would make sense.... Don't know how I didn't see that

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.