There’s your issue then,
You’re setting it to false
there, remove Thrown = false
, it never receives because it will never be true by the time you try to receive
There’s your issue then,
You’re setting it to false
there, remove Thrown = false
, it never receives because it will never be true by the time you try to receive
Then I would just be back where I was at my original script, the “thrown = false” was added as per @MrchipsMa’s suggestion.
A debounce is the avoid the function from running repeatedly and block another signal from being created, which is why they set it back to false
at the end of the routine in their suggestion.
For your situation, your boolean is more of a status of your Hammer, not really a debounce. Delete the Thrown = false as @EmbatTheHybrid suggested and it should work.
Moreover, think of a debounce as a cooldown.
The problem is though, the current script you have now will never retrieve the mjonir cause Thrown
will never be true as it’s set to true and immediately set to false. If it’s not working either after you do that, I can’t tell if it’s something wrong with the Thrown
variable.
Alright I tried printing a statement after firing server and it prints so the client successful firedserver, however it doesn’t print(“Retrieval in motion”) on the server side.
Is state checking like this viable:
Throw.OnServerEvent:Connect(function(Player,Direction,State)
elseif State == "Retrieve" then
print("Retrieve in motion")
end
end)
Did removing the Thrown = false
line do anything by chance? If not, then I am extremely confused as it should work after removing that line
UIS.InputBegan:Connect(function(Input,IsTyping)
if IsTyping then return end
print(Thrown)
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
-- Mjolnir Throw
if Thrown == false then
Thrown = true
ThrowEvent:FireServer(Mouse.Hit,"Throw")
end
elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then
-- Mjolnir Return
print("Recived right click")
if Thrown == true then
Thrown = false
wait(5)
print("Sending receive to ThrowEvent")
ThrowEvent:FireServer(Mouse.Hit,"Retrieve")
end
end
end)
Wait, try printing inside of the MouseButton2 as well
I did, I removed it but the puzzling problem still persists and runs deeper than that i’m afraid.
Add a print after the MouseButton2
line to see if it’s even going there in the first place
I did, all the print statements i added to the end of the local script runs. It’s just not picking up on the server for some frustrating reason.
Even this didn’t work? Was it printing “Recived right click”?
UIS.InputBegan:Connect(function(Input,IsTyping)
if IsTyping then return end
print(Thrown)
if Input.UserInputType == Enum.UserInputType.MouseButton1 then
-- Mjolnir Throw
if Thrown == false then
Thrown = true
ThrowEvent:FireServer(Mouse.Hit,"Throw")
end
elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then
-- Mjolnir Return
print("Recived right click")
if Thrown == true then
Thrown = false
wait(5)
print("Sending receive to ThrowEvent")
ThrowEvent:FireServer(Mouse.Hit,"Retrieve")
end
end
end)
it did, this is the client side. the problem’s on the server side.
Okay, can we see the Server sided code?