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

How do I fix this?

Asked by 7 years ago
Edited 7 years ago
script.Parent.Touched:connect(function(plr)
    local UIS = game:GetService("UserInputService")
    UIS.InputBegan:connect(function(input)
        if input.KeyCode == Enum.KeyCode.G then
            script.Parent.Parent.Parent:Destroy()
        end
    end)
end)

My problem is that the script will work successfully in ROBLOX Studio, but in a ROBLOX Server it will not work.

This is a Regular Script, It's parent is a brick inside a torso of a clone of a player's character

So I want it so when they touch the brick inside the torso it lets them press G to destroy the Character.

In my last post, someone pointed out that I should use a Remote Event and that I should change it to a local script but i feel like that didn't work.

0
Like said before, you can't get user input in a server script. Request this from a Remote Event. Please don't duplicate your questions. cabbler 1942 — 7y
0
As cabbler said, don't use a normal script. Also, if u are putting this in PLAYERS and not humanoids... when someone touches your brick, if you click G, you die. User#17125 0 — 7y

Answer this question