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

Is there a way to use local script stuff for a server script?

I'm trying to do a 2x XP thing, But I cant use MarketPlaceService because I always get an error when I try to use it so I started using GamePassService but now I cant get the mouse of the player... The reason I need the mouse is because of the keybind so I'm kinda stuck? can anyone help me out??

This is what I'm working with:

local MP = game:GetService("GamePassService")
local mouse = Player:GetMouse()


mouse.KeyDown:Connect(function(key)
    local Train = math.random(1,3)
    if key == "t" then
        if db == false then 
        db = true
        --your code

1 comment

0

No. Learn to use RemoteEvents and RemoteFunctions.

1 answer

✓ Accepted answer

If you need communication between server and client, you would use RemoteEvent or RemoteFunction.

Also, using the mouse for keybind is deprecated. It's recommended to use UserInputService instead.

userinput = game:GetService("UserInputService")

function keybind(keypressed, gameProcessedEvent)
	if keypressed.KeyCode == Enum.KeyCode.T then
		print("T was pressed")
		--etc
	end
end

userinput.InputBegan:connect(keybind)

Like mouse keybinds this script has to be a local script.

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