#help
1 messages · Page 1 of 1 (latest)
Do you mean Input.KeyCode?
when I use the script that i made there arent any errors when i press E and yet it doesn't do anything
where is the script placed
beat me to it
under a tool
under a tool
maybe try instead of "player.Character.Humanoid.WalkSpeed = 25" try "Humanoid.WalkSpeed = 25"
cause you already defined humanoid
test out if
tool.Activated:Connect(function()
print("test")
end)
works
if it does then its a problem on how your handling the inputs
didnt work
alr
and maybe replace Input.UserInputType to Input.KeyCode
someone already said that
oh
it did not work
i also tried it with local tool = script.Parent at the start
which also didnt work
huh idk why its not working
wait so is the speed working and not toggling or is it just not working at all
oh wait that's so true
tool.Equipped:Connect(function)
its not function()?
Good catch
ty
wait
** You are now Level 3! **
sh
local UserInputService = game:GetService("UserInputService")
local tool = script.Parent
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if gameProcessed then return end
if input.KeyCode == Enum.KeyCode.E then
if tool.Parent:FindFirstChild("Humanoid") then
local character = tool.Parent
local humanoid = character:WaitForChild("Humanoid")
humanoid.WalkSpeed = 25
end
end
end)
try this
np
wait
i have a question
if tool.Equipped is a signal
then how do I check for it
tool.Equipped:Connect(function()
end)
well yeah i know that
so i can only use it as a signal for a function?
there isnt a variable equivalent?
variable equivalent?
wait I'm stupid arent I
not directly from tool
Do i have to check from starterplayerscripts
you can get a variable by checking if the tool is under the player's character or do something like:
local Tool = script.Parent
local ToolEquipped = false
Tool.Equipped:Connect(function()
ToolEquipped = true
end)
Tool.Unequipped:Connect(function()
ToolEquipped = false
end)
i mean like there is no variable like Tool.IsEquipped or something like that
np
sorry to bother you again lol but how would I debug this
im gonna go ask gpt
you can add print everywhere
oh yeah
this is what happened
wait
local UserInputService = game:GetService("UserInputService")
local tool = script.Parent
UserInputService.InputBegan:Connect(function(Input, gameProcessed)
if gameProcessed then return end -- Optional: ignore if typing in chat
if Input.KeyCode == Enum.KeyCode.E then
if tool:IsDescendantOf(game.Players.LocalPlayer.Character) then
local Player = game.Players.LocalPlayer
local Character = Player.Character
if Character then
local Humanoid = Character:FindFirstChild("Humanoid")
if Humanoid then
Humanoid.WalkSpeed = 25
end
end
end
end
end)
what is that function
tool.Equipped:Connect(function()
why do you put that inside the userinputservice.inputbegan part
should I use onToolEquipped instead?
I want to make a player's movespeed 25 when they equip the tool
oh
huh
i thought you wanted press e or smth
idk if this is what you meant lol
does it make your player faster
local tool = script.Parent
tool.Equipped:Connect(function()
local character = tool.Parent
local humanoid = character:WaitForChild("Humanoid")
humanoid.WalkSpeed = 25
end)
it definitely doesnt work for me
it doesnt work for some reason
do you have any errors
no
is this the whole script
yes
can you paste this in there
it should be the same thing
add a print at the top of the script
print works
and you said that the print inside of the .Equipped function dosent work
the one u had before
ye
does the tool have a handle
set it to false
everyone makes small mistakes
yes
you can also make it remove the extra speed by using tool.Unequipped
and setting the speed to 16
yea
or any speed that you have by default in your game
yes
i have an error
it doesnt remove the speed
Infinite yield possible on 'Players.spammerton1.Backpack:WaitForChild("Humanoid")
ohh
oops
its bc the tool goes in the backpack
and is no longer in the character
how do I solve it then
** You are now Level 4! **
add
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local humanoid = Character:WaitForChild("Humanoid")
``` add this at the start
i edited it
now
delete character = and humanoid = from inside of the functions
the whole lines
i edited the 3 lines again a bit