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..
1 | local LogService = game:GetService( "LogService" ); |
2 |
3 | LogService.MessageOut:Connect( function (message, messageType) |
4 | if not (messageType = = enum.MessageType.MessageOutput) then return end |
5 | if (message = = "buffed" then |
6 | --the code to increase damage goes here |
7 | end |
8 | end ) |
Set "buffed" script:
1 | local buffed = game.Workspace:WaitForChild( "Buffed?" ) --Name and location of your boolValue |
2 |
3 | buffed.Value = true |
Read "buffed" script:
1 | local buffed = game.Workspace:WaitForChild( "Buffed?" ) |
2 |
3 | buffed.Changed:Connect( function () |
4 | if buffed.Value = = true then |
5 | --Code |
6 | end |
7 | end ) |
As far as I am concerned, that is not possible. Just simply use a variable like this:
1 | local buffed = true |
2 |
3 | if buffed then |
4 | --Increase damage |
5 | else |
6 | --Do nothing |
7 | end |
In other words, instead of doing a print, change the variable.
Hope this helped!