Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Roblox Studio output bar not printing anything from local scripts, why?

Asked by 3 years ago
Edited 3 years ago

Hi, So I'm unsure if this post counts on this website as It's about code, so let me know if it's unwelcome. Anyways, I have an issue with Roblox studio in general, The output bar is printing no errors or print statements from local scripts. It prints just fine from a Server script, as I've tested that. Here is the code I'm running, nothing is printing or giving me errors.

local plr = game.Players.LocalPlayer
local hum = plr.Character.Humanoid
print("Running")
script.Parent.Touched:Connect(function(hit)
    print(hit)
    if hit.Parent:WaitForChild("Humanoid") == true then
        print("bruh")
    end
end)

How can I fix this so I get output from a local script? Thanks!

I should mention that I am in collaborative editing, I'm the owner. This has happened to me before in solo editor games so I don't think that's the issue, but I figured I'd add that here.

0
Where is the local script placed in your game Befogs 113 — 3y
0
Starter Character Scripts pokemine1o9 44 — 3y
0
And one is in a Part, It's all Local Scripts by the way. pokemine1o9 44 — 3y
0
Why do you have script.Parent.Touched in Starter Character Scripts? Ascarson4 138 — 3y
0
That script is not in starter character scripts, it's in The part pokemine1o9 44 — 3y

3 answers

Log in to vote
1
Answered by
Ascarson4 138
3 years ago

Local scripts located in the workspace do not run. You gotta put it somewhere in the player.

0
Oh I see, Thank you! pokemine1o9 44 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

Use ~= nil instead of == true

local plr = game.Players.LocalPlayer
local hum = plr.Character.Humanoid
print("Running")
script.Parent.Touched:Connect(function(hit)
    print(hit)
    if hit.Parent:WaitForChild("Humanoid") ~= nil then
        print("bruh")
    end
end)
0
The scrip is not an issue. The issue is that my scripts dont print errors or any print statements. pokemine1o9 44 — 3y
0
Funny, he doesn't know the answer yet he'll teach you why your answer is wrong. Haha! Roger111 347 — 3y
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

I'm not sure if this is the issue, but the local script with the .Touched event MUST be a descendant of the player. If the script with .Touched is inside the part then it wont work. I recommend putting this script inside of the player, and then referencing the part seperately.

local plr = game.Players.LocalPlayer
local hum = plr.Character.Humanoid
local part = workspace.(PART)
print("Running")
part.Touched:Connect(function(hit)
    print(hit)
    if hit.Parent:WaitForChild("Humanoid") == true then
        print("bruh")
    end
end)

Answer this question