Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why can't I put this LocalScript into PlayerScripts?

Ok, so here's my problem. Today, I found out just where I should put my UserInputServiceScript using a module script. Although, when I try to clone the UserInputService script and put it into PlayerScripts, it doesn't work!

Code:

local CombatScript = {}

 function CombatScript.Owner(PlayerName)
	
	local playerOwner = game:GetService("Players"):FindFirstChild(PlayerName)
	local clone = script.LocalScript:Clone()
	clone.Parent = game:GetService("Players")		[PlayerName]:FindFirstChildOfClass("PlayerScripts") --Why isn't the script going into PlayerScripts?"
	clone:WaitForChild("FindModulePlayer"):Fire(playerOwner)
end

return CombatScript

And here is what I used in Developer console to require it:

require(game.workspace.MainModule).Owner("Howatcha")

1 comment

0

Putting the localscript in StarterPlayerScripts replicate it into PlaerScripts. located in StarterPlayer

1 answer

Might be a bit of a stupid counter-question, but have you actually run the module script by a regular script? Without it, you wouldn't be able to do so. If you have already done such a thing, then please edit your question with the code where you required the module script. I'll delete my answer afterward.

local test = require(game.ServerScriptService.ModuleScript)
test.Owner("Howatcha")

1 comment

0

Yes, I have, I will do this.

This discussion is preserved as it was. New answers, comments, and votes are closed.