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

Is it actually possible to make a teleportation command in a module script?

Asked by 3 years ago

I am working on an Admin for games and such, I am taking a quite abnormal approach and because of this I have no clue about quite a bit.

The way I have the Admin set up is, when you enter a command in the GUIs command bar and press enter, it searches a folder full of folders and module scripts named 'Source' and requires the correct commands source file.

Due to this approach I am trying to make my [;goto] command, but I am having an issue where it doesn't replicate / doesn't even teleport or show any change to the server side, and remote events are not an option.

Source:

local Source = {}

local String = [[
    Ray Admin has encountered an error while executing the requested command, for the [;goto] command
    you are required to include an argument, which must be a players full name.

    (We are not yet developed for Display Names, so use the username. To get a list of all users run [;userlist])

    v1.0 (BETA) (R15 ONLY)
]]

function Source.main(Player, Args)
    local notifModule = require(script.Parent.Parent.Parent.Modules.notifModule)
    if Args[2] then
        for i,v in pairs(game.Players:GetChildren()) do
            if v.Name == Args[2] then
                local C = workspace:FindFirstChild(Player.Name)
                local T = workspace:FindFirstChild(Args[2])
                C.UpperTorso.Position = T.UpperTorso.Position
            end
        end
    else
        notifModule.notify(String)
    end
end

return Source

(The notification module I made works fine, the error is not documented but if I had to guess it is likely line 19, or C.UpperTorso.Position = T.UpperTorso.Position.)

1 answer

Log in to vote
0
Answered by
Speedmask 661 Moderation Voter
3 years ago

well, that’s not terribly abnormal, in fact that’s basically what most people do when they create a modulescript that in turn requires its children, creating a giant library of sorts, but this just uses a folder. that said, your problem still has to do with the structure of your scripts as I see three things that hold you back.

  1. the fact that everything is named Source is for sure not good practice, I would advise you to rethink that. using a modulescript instead of a folder is also probably for the best so you can just use require instead of some weird search behavior every time.
  2. you said the error is not documented, do you mean nothing happened or was it hidden by something? if it was, that’s a seeerious problem for your workflow.
  3. the source of your problem, is pretty simple. you need remote events. no way around that dude. if you are calling this script on the client then nothing is going to replicate unless you use them. may I ask what’s the reason you can’t use remote events?
Ad

Answer this question