im making a buff move on the sword when you press F it prints
print("Buffed")
how can i detect that in the script?
im triyng to make it like
if printed ("buffed") then
damage increases
You could use the LogService
.. it allows you to listen for when text is printed in the output.. Although I recommend only using it for logging
purposes, it should work for your purpose..
local LogService = game:GetService("LogService"); LogService.MessageOut:Connect(function(message, messageType) if not (messageType == enum.MessageType.MessageOutput) then return end if(message == "buffed" then --the code to increase damage goes here end end)
Set "buffed" script:
local buffed = game.Workspace:WaitForChild("Buffed?") --Name and location of your boolValue buffed.Value = true
Read "buffed" script:
local buffed = game.Workspace:WaitForChild("Buffed?") buffed.Changed:Connect(function() if buffed.Value == true then --Code end end)
As far as I am concerned, that is not possible. Just simply use a variable like this:
local buffed = true if buffed then --Increase damage else --Do nothing end
In other words, instead of doing a print, change the variable.
Hope this helped!