Alright, so…
I have two scripts that don’t work, even though they are supposed to so far I know.
Here’s the first one which I literally copied from a youtuber:
local minHeight = 10
local maxHeight = 30
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local playerheight = nil
local fallheight = nil
if humanoid and humanoidRootPart then
humanoid.FreeFalling:Connect(function(newState)
if newState then
playerheight = humanoidRootPart.Position.Y
elseif not newState then
fallheight = playerheight - humanoidRootPart.Position.Y
if fallheight >= maxHeight then
humanoid.Health = humanoid.Health - 100
elseif fallheight >= minHeight then
humanoid.Health = humanoid.Health - math.floor(fallheight)
end
end
end)
end
end)
end)
and here is the problem child:
UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Shift = player.PlayerGui.ScreenGui.Shifttorun
UserInputService:Connect(function(input)
if input.Keycode == Enum.KeyCode.LeftShift then
print("Pressed LeftShift")
Shift.TextTransparency = 1
print("TextTransparency has been changed.")
end
end)
UserInputService.InputBegan:Connect(function(input, gpe)--gpe checks if they are typing in chat
if gpe then return end --Stops the script if they are typing in chat
if input.Keycode == Enum.KeyCode.LeftShift then
print("Pressed LeftShift")
Shift.TextTransparency = 1
print("TextTransparency has been changed 2.")
end
end)
I’ve already made a post about this one, asked for help in a discord server… gone through multiple fixes and still… doesn’t work.
Does anyone know what is going wrong?