script.Parent.Equipped:connect(function(mouse)
script.Parent.Activated:connect(function()
local char = script.Parent.Parent
script.Parent.glob:FireServer(mouse.hit.p)
--workspace.Terrain:FillBlock(mouse.hit,Vector3.new(7,10,7),--[[mouse.Target.Material]]Enum.Material.Air)
end)
end)
10:58:43.197 This Mouse is no longer active - Client - LocalScript:4
10:58:43.197 Stack Begin - Studio
10:58:43.198 Script 'Players.Talls_Smols.Backpack.Ice.LocalScript', Line 4 - Studio - LocalScript:4
10:58:43.199 Stack End - Studio
Help please. The script above is a local script.
3 Likes
I have never seen someone take the mouse the way you did. Maybe I am mistaken and your way is valid but try taking it this way.
local mouse = game.Players.LocalPlayer:GetMouse()
script.Parent.Equipped:connect(function()
script.Parent.Activated:connect(function()
local char = script.Parent.Parent
script.Parent.glob:FireServer(mouse.hit.p)
--workspace.Terrain:FillBlock(mouse.hit,Vector3.new(7,10,7),--[[mouse.Target.Material]]Enum.Material.Air)
end)
end)
1 Like
It doesnt not work and has no output.
1 Like
Strange. I will look more into it. Does the whole function runs? if not where does it stop working.
So basically I have tools in lighting (because it cant find it in server storage) and when you click a text button then it clones the tool and puts it in the backpack. It works to the point of putting it in the backpack but when I click it is meant to spawn terrain depending on which tool you choose. It seemed to work fine when I put the tools in starter player but now that I clone them it doesnt seem to work. Btw thanks @Dev_Simphony for helping. 
1 Like
would you like me to give you one tool? they are the same tools withe the enum.Material changed.
1 Like
Sure. It would be good since I will be able to work on it directly
Awesome. I will get back to you as soon as possible.
The problem seems like when it clones it does not run this part of the script :
function fill(player,blob)
workspace.Terrain:FillBlock(CFrame.new(blob),Vector3.new(7,7,7),--[[mouse.Target.Material]]Enum.Material.Air)
print("ran")
end
script.Parent.glob.OnServerEvent:Connect(fill)
I added a print statement and when its in starterpack it runs but when it clones it doesnt. Know all I have left is to find out why.
1 Like
Just found out that the problem has nothing to do with the cloning. it’s probably something with the moving.
1 Like
I think its because it is in lightning how do i do it so that it clones from server storage?
1 Like
There are several ways to make it clone from sevrerstorage. It is different from normal but here are some.
- The user chooses a part via GUI (LocalScript), for example, “Tool”
- Still in LocalScript, I call a RemoteFunction which is stored in a script inside
ServerScriptService
, passing “Tool” (.Name, string) as the argument
- Within the ServerScript, the RemoteFuncion will find the “Tool” inside the list of parts in
ServerStorage
(using FindFirstChild()
)
- Found “Tool” on ServerStorage, the RemoteFuncion will
.Parent
this part to ReplicatedStorage
and return this part to LocalScript (this will in fact transfer all the bytes of “Tool” to all players, but it will not be available for them)
- The original function called in LocalScript receives the part reference (via return) and then
:Clone()
it to workspace.
- Once this clone was made via LocalScript, “Tool” will be only visible/available for the current player.
I mean like
local A = game.Serverstorage.Tool:clone
A.Parent = player.Backpack
1 Like
Yeah I don’t think that’s possible.
1 Like
Why go through all that effort when the client could just fire a RemoteEvent that would tell the server to clone the requested tool and parent it to the player’s backpack?
1 Like
Awesome I fixed it!! Alright I made a remote event to fire it and now it works
could you send it to me please?
1 Like
LOL you came directly when I tried to do it.
Yes of course. Coming right up mate. fixed tool.rbxl (334.3 KB)