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:
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?
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)
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
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?