I am trying to make a function where you turn invisible if you press q and I made everything else but changing the players transparency doesn't work the script:
local Player = game.Players.LocalPlayer local plr = script.Parent.Parent.Transparency local dmg = true local cooldown = false local TransparencyI = true game:GetService("UserInputService").InputBegan:connect(function(input, gamepor) if (input.KeyCode == Enum.KeyCode.F or input.KeyCode == Enum.KeyCode.ButtonY) and TransparencyI == true and cooldown == false then -- dont touch plr = 1 wait(40) plr = 0 TransparencyI = false cooldown = true wait(60) TransparencyI = true cooldown = false end end)
on line 2 you are simply making a shallow copy. which means, you're getting the player's current transparency at that time and that's it. the variable and the player's transparency are not linked. if you just get the actual object, though, you can still change it directly.
try this.
local plr = script.Parent.Parent if --blah blah blah plr.Transparency = 1 wait(40) plr.Transparency = 0 end
also unless you are using cooldown
and TransparencyI
elsewhere there is no point in having both when they are always opposite. you could just use one of them.
Uhm, thats not how it really works, let me help you a bit. 1.You cant make a model transparent. 2.You cant set it to 1 and 0 and pretend its actually changing anything, dont mention .Transparency and only the player. plr.Transparency = 1 for example (ITS NOT GONNA WORK YOU CANT MAKE A MODEL TRANSPARENT BTW) the rest should work properly, i'd be nice if you gave us which line the error appears on. have a good day!