This script doesnt work, requiresHandle is disabled and the prints are not showing in the output.
local module = require(script.Parent:WaitForChild("ModuleScript"))
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Debounce = true
local Character = player.CharacterAdded:Wait() or player.Character
local hum = Character:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local Idle = animator:LoadAnimation(script:WaitForChild("Idle"))
local SitUp = animator:LoadAnimation(script:WaitForChild("SitUp"))
script.Parent.Activated:Connect(function()
print("lifted")
module.Lift()
end)
script.Parent.Activated:Connect(function()
print("animation")
if Debounce == false then return end
Debounce = false
SitUp:Play()
wait(0.3)
Debounce = true
end)
script.Parent.Equipped:Connect(function()
print("equipped")
Idle:Play()
hum.WalkSpeed = 0
hum.JumpPower = 0
end)
script.Parent.Unequipped:Connect(function()
print("unequip")
hum.WalkSpeed = 16
hum.JumpPower = 50
end)
its a local script
Is this a script? A local script? What are you trying to do? Where are the scripts located?
1 Like
Can you show the ModuleScript?
local module = {}
local replicatedStorage = game:GetService("ReplicatedStorage")
function module.Lift()
replicatedStorage.Remotes.Lift:FireServer()
end
return module
i fixed it this is my new script for anyone curious:
local module = require(script.Parent:WaitForChild("ModuleScript"))
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local Debounce = true
local Character = player.Character
local hum = Character:WaitForChild("Humanoid")
local animator = hum:WaitForChild("Animator")
local Idle = animator:LoadAnimation(script:WaitForChild("Idle"))
local SitUp = animator:LoadAnimation(script:WaitForChild("SitUp"))
script.Parent.Activated:Connect(function()
print("lifted")
module.Lift()
end)
script.Parent.Activated:Connect(function()
print("animation")
if Debounce == false then return end
Debounce = false
SitUp:Play()
wait(0.3)
Debounce = true
end)
script.Parent.Equipped:Connect(function()
print("equipped")
Idle:Play()
hum.WalkSpeed = 0
hum.JumpPower = 0
end)
script.Parent.Unequipped:Connect(function()
print("unequip")
Idle:Stop()
hum.WalkSpeed = 16
hum.JumpPower = 50
end)
the problem was this:
local Character = player.CharacterAdded:Wait() or player.Character
You can add Player.CharacterAdded:Wait()
in the variable just incase the character didn’t load yet.
Just make sure Player.Character
is first because when the player joins, there is a glitch where Player.CharacterAdded
doesn’t fire.
local Character = player.Character or player.CharacterAdded:Wait()
2 Likes
system
(system)
Closed
September 15, 2023, 6:47am
#8
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.