I know the title is weird but I dont know how else to explain this.

Here let me give you the run down real quick.

This script gives a play a tool after he presses a GUI button. The GUI is located under player.PlayerGui

It gives the player the gun but when the player equips the tool it just falls through the map and the place that it was created. This script works in studio but not in actual ROBLOX? Any ideas?

Heres the code

local replicatedstorage = game:GetService("ReplicatedStorage")

local player = game.Players.LocalPlayer
local button = script.Parent:FindFirstChild("Play")

button.MouseButton1Click:connect(function()
	local weapon1 = replicatedstorage:FindFirstChild("Thompson")
	local newweapon1 = weapon1
	newweapon1:Clone().Parent = player.Backpack
	newweapon1:Clone().Parent = player.StarterGear
	script.Parent.Parent:Destroy()
end)


1 comment

0

If it isnt in a local script it may not work in actual roblox due to the difference between server scripts and local scripts.