I have a sand bucket in serverstorage and this inside of it:
I have the LocalScript to play the animation when you click your miuse but i want to set the sand parts transparency so that it looks like you have sand in your bucket but i cant get this to work and i want it to be on the server so everyone can see it. Heres the localscript although i might need a regular script for the sand part:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")
local tool = script.Parent
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7378586179"
local loaded = Animator:LoadAnimation(animation)
tool.Activated:Connect(function()
loaded:Play()
end)
local player = game.Players.LocalPlayer
local GUI = player.PlayerGui
script.Parent.Activated:Connect(function() --[[you can add a
variable for the tool for more easy reference]]
GUI.BucketGui.Enabled = true --[[ replace screenGui with the name of the screenGui,
and always make sure the ScreenGui is not enabled in the first place.]]
end)
script.Parent.Unequipped:Connect(function()
GUI.BucketGui.Enabled = false
end)
Most of the functions and events you are using should work in a server script, so you can put that in a server script instead of a local script.
You can change the transparency property of sand parts within the Tool.Activated event.
local player = script:FindFirstAncestorWhichIsA("Player") or game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent)
local character = player.Character or player.CharacterAdded:Wait()
local Animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")
local tool = script.Parent
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7378586179"
local loaded = Animator:LoadAnimation(animation)
local GUI = player.PlayerGui
tool.Activated:Connect(function()
loaded:Play()
GUI.BucketGui.Enabled = true
end)
local player = script:FindFirstAncestorWhichIsA("Player") or game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent)
local character = player.Character or player.CharacterAdded:Wait()
local Animator = character:WaitForChild("Humanoid"):WaitForChild("Animator")
local tool = script.Parent
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7378586179"
local loaded = Animator:LoadAnimation(animation)
local GUI = player.PlayerGui
tool.Activated:Connect(function()
loaded:Play()
GUI.BucketGui.Enabled = true
tool.Sand.Transparency = 0
end)
local GUI = player.PlayerGui
script.Parent.Unequipped:Connect(function()
GUI.BucketGui.Enabled = false
end)
Your Sand is not welded to the bucket. When you equip the tool, can you still see the Sand in the Tool tree under your Character? Is it still in the same area you expected, ie contained within the bucket?
If not, then you need to weld Sand to the Handle
I understand that, but you might find that because the Sand part is not Welded to the Handle part, that it drops out.
Play the game in Studio, locate the part in Explorer, then click the Move tool to show you where it actually is in world space. I doubt it is where you expect it to be.