Question, Is this a Bug?

So I made a Platforming game where you can attack, and when you attack there is a BoolValue that is in the character. when you press the boolvalue you can see clearly:

Screenshot 2024-01-11 at 1.06.59 PM

but when i do the code:

local hitbox = script.Parent

local function touch(hit)
	local atbool = hit.Parent:FindFirstChild("AttackBool")
	if hit.Parent:FindFirstChild("Humanoid") then
		if not atbool then return end
		print(atbool.value)
	end
end
hitbox.Touched:Connect(touch)

And It always prints as false.


Is this a Studio bug?
Is the place corrupted?
Am I doing something wrong?

2 Likes

Are you pressing the value in the client?

it’s in the player’s character model

Right but when you’re testing do you switch to the server change the value go back to the client and test

no i have a input (such as rightshift) to change the value

And that changes it on a server script

yeah you’re gonna need to change that in a server-side script for it to register properly

make a RemoteEvent in ReplicatedStorage and make the client fire the event when the deginated input is inputted.

Client side:

local event = game.ReplicatedStorage:WaitForChild("RemoteEvent") --your event here
event:FireServer()

Server side:

--the 'player' parameter is automatically passed from client to server
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(player)
    local var = player.Character:FindFirstChild("AttackBool")
    if var then
        var.Value = true --whatever you want the value to be set to
    end
end)
1 Like

Yeah, I maked a IntValue in ServerScriptService to use it as an Event multiplier, but I can’t change value from x2 to x1, because after I change it, it turns back to previous value. And also, when I make something in my game with tonumber(), like transfer money to other player system, it somehow rewards player with additional 100 money from air, if you’re gave >1000 money, or don’t gave anything if you’re gave 1

But now it’s fixed, like 2-3 days ago

I have implemented the same setup and code as the one featured in your post. From my results, the return value is always true, perhaps the issue is found elsewhere in your game, maybe in a different script that alters/interacts with the same AttackBool value?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.