#Collision group not always working
1 messages · Page 1 of 1 (latest)
You didnt set up CollisionGroups Properly.
Can i see the collision groups?
oh yeah it's fixed It was a weird probleme due to a union lol
but I have another question if you can help me with
?
since in my game there will be 500+ moving parts, the network would be jammed. So instead, client will run those parts and the server is only so people can't exploit. The server's part will be giving money to the player.
The server script is done
the client is almost done but I'm stuck there for 2h
Icreate the client side part
but I need to do something to their cash.Value get upgraded when they touch the upgrader and destroy them when they hit the part collector
and then I need to update the Gui so that the player can see the new cash value
Update the players money on the server
Destroy the client side parts on the client
What is the problem?
You can use a GetPropertyChanged signal on the leaderstats cash value to update the gui automatically when their cash changes.
yeah the money is getting updated right. the server script is perfect.
I want to track the value of the single drop part
it has a value as a child
Give the part an attribute of its value then
yes
wait let me show you
I need to locate the upgrader and poart collector:
I'mm so lost
okok
see here
dropEvent.OnClientEvent:Connect(function(items, spawner, OwnerValue)
local drop = dropperItems:FindFirstChild(items)
local scriptClone = script:FindFirstChild("LocalScript"):Clone()
local cloneGui = billBoardGui:Clone()
local dropClone = drop:Clone()
dropClone.Parent = game.Workspace.Tycoons.DropperParts
dropClone.CollisionGroup = "Drops"
local ownerValue = Instance.new("ObjectValue")
ownerValue.Value = OwnerValue
ownerValue.Parent = dropClone
ownerValue.Name = "OwnerValue"
dropClone:PivotTo(spawner)
local cashValue = Instance.new("IntValue", dropClone)
cashValue.Value = 5
cashValue.Name = "CashValue"
cloneGui.Parent = dropClone
cloneGui.Frame.TextLabel.Text = "$"..cashValue.Value
scriptClone.Parent = dropClone
Debris:AddItem(dropClone, 15)
for i, tycoon in pairs(game.Workspace.Tycoons:GetChildren()) do
if tycoon.Name == "Tycoon" then
if tycoon.Values.OwnerValue == OwnerValue then
local partCollector = tycoon.MainItems.PartCollector
if tycoon.Purchases:FindFirstChild("Upgrader") then
local upgrader = tycoon.Purchases:FindFirstChild("Upgrader").Upgrader
end
break
end
end
end
partCollector.Touched:Connect(function(hit)
if hit:FindFirstChild("CashValue") then
hit:Destroy()
end
end)
end)
why isn't it working
not destroyibng the part
** You are now Level 11! **
Are you using attributes or values?
That’s not what he’s trying to do.
😂 hit is the dropper part
Not a player
I'm not sure of the difference, but I think I'm using values
If you aren't using object:GetAttribute and SetAttribute then most likely yeah
Besides, it's the highest likelihood that the part isn't being deleted due to "CashValue" not being found.
** You are now Level 13! **
for i, tycoon in pairs(game.Workspace.Tycoons:GetChildren()) do
if tycoon.Name == "Tycoon" then
if tycoon.Values.OwnerValue == OwnerValue then
local partCollector = tycoon.MainItems.PartCollector
if tycoon.Purchases:FindFirstChild("Upgrader") then
local upgrader = tycoon.Purchases:FindFirstChild("Upgrader").Upgrader
end
break
end
end
end
partCollector.Touched:Connect(function(hit)
if hit:FindFirstChild("CashValue") then
hit:Destroy()
end
end)
Why are you declaring the upgrader variable but never using it?
Another thing is that here "partCollector" won't exist as you declare it within the scope of the loop
The upgrader would 2x de cash value then the text label in the gui of the part would show the new cash.value
In serverscript, I find it easy to do, but in local script it's never working
Attribute is better than value?
Thanks a lot for helping me btw 🫡
I changed my script a bit yesturday. Once I get back home I'll show you
Ok I'm back
Not one is better than the other, it depends on your use case
can you send a folder in a remote from server to client?
a folder that already exist
You can send a table/dictionary
not a folder?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Debris = game:GetService("Debris")
local dropEvent = ReplicatedStorage:FindFirstChild("RemoteEvent"):FindFirstChild("SpawnDrop")
local dropperItems = ReplicatedStorage:FindFirstChild("DropperItems")
local billBoardGui = game.ReplicatedStorage:FindFirstChild("BillboardGui")
dropEvent.OnClientEvent:Connect(function(items, spawner, partCollector, upgrader)
local drop = dropperItems:FindFirstChild(items)
local dropClone = drop:Clone()
local scriptClone = script:FindFirstChild("LocalScript"):Clone()
local cloneGui = billBoardGui:Clone()
dropClone.Parent = workspace.Tycoons.DropperParts
dropClone.CollisionGroup = "Drops"
dropClone:PivotTo(spawner)
local cashValue = Instance.new("IntValue", dropClone)
cashValue.Value = 5
cashValue.Name = "CashValue"
cloneGui.Parent = dropClone
cloneGui.Frame.TextLabel.Text = "$"..cashValue.Value
scriptClone.Parent = dropClone
Debris:AddItem(dropClone, 15)
partCollector.Touched:Connect(function(hit)
if hit == dropClone then
hit:Destroy()
end
end)
if upgrader ~= nil then
upgrader.Touched:Connect(function(hit)
if hit == dropClone then
hit:FindFirstChild("CashValue").Value = 2 * hit:FindFirstChild("CashValue").Value
end
end)
end
end)
this one is working
only one thing isn't working
thats the child script:
repeat wait() until script.Parent:FindFirstChild("CashValue")
script.Parent:WaitForChild("CashValue").Changed:Connect(function()
script.Parent.BillboardGui.Frame.TextLabel.Text = "$"..script.Parent:WaitForChild("CashValue").Value
end)
it's not updating the Text when the cash value change
please @bright axle I don't know what's wrong
The value really change and the script is in the part
don't use repeat wait
WaitForChild already yields for u
until its found
it does not work with that too
whitout that
it's weird since the value geet changed
they are both localscript if that can help
what?